Files
kumomta/Cargo.toml
T
Wez Furlong fead711c80 mailparsing: improve charset detection/conformance fixing
We found an interesting issue where a MIME part was labelled as `text/`
with no explicit charset (and was thus implicitly "us-ascii", according
to the specs).  The content was actually UTF-8 encoded farsi text.

Since encoding_rs treats us-ascii as being an alias for windows-1252,
that part was re-encoded as bogus data, rather than being recognized as
UTF-8.

This commit improves the outcome in this situation:

1. Remove encoding_rs.  Replace its Charset type with the Encoding type
   that I added to the charset-normalizer crate in
   https://github.com/nickspring/charset-normalizer-rs/pull/45
   which allows us to actually differentiate between 7-bit ascii
   and latin-1.
2. Improve the handling of body part extraction; there were a couple
   of cases where we didn't consider the charset for text parts(!)
   and now we do, with some additional smarts for when the charset
   fails to decode.
3. Improve the conformance checking.  We do the majority of this
   during parsing, but we don't check for deeper issues such as
   the charset not matching the transfer-decoded payload because
   that is too costly to do for the majoriy of parses.  This commit
   introduces a deep conformance check that does validate that we
   can extract the part, flagging any failures as
   NEEDS_TRANSFER_ENCODING.
4. The charset detection options are threaded through the conformance
   checks and into the logic that extracts the parts during a rebuild,
   so that we can fix up those parts during rebuild.

The bulk of the conformance checking/fixing has been moved into the
mailparsing crate from the message crate, which makes the above a bit
easier and centralizes that logic better--fewer places to look to figure
things out.
2025-12-17 10:31:59 +00:00

235 lines
7.1 KiB
TOML

[workspace]
members = [
"crates/bounce-classify",
"crates/cidr-map",
"crates/domain-map",
"crates/integration-tests",
"crates/kcli",
"crates/kumo-address",
"crates/kumo-chrono-helper",
"crates/kumo-dmarc",
"crates/kumo-prometheus",
"crates/kumo-spf",
"crates/kumo-template",
"crates/kumo-wrap",
"crates/kumod",
"crates/mailparsing",
"crates/mod-aws-sigv4",
"crates/mod-file-type",
"crates/mod-mimepart",
"crates/mod-mpsc",
"crates/mod-smtp-response-normalize",
"crates/mod-time",
"crates/mod-uuid",
"crates/mta-sts",
"crates/proxy-server",
"crates/regex-set-map",
"crates/rfc5321",
"crates/run-lua-tests",
"crates/spool",
"crates/spool-util",
"crates/summarize-memory",
"crates/tailer",
"crates/throttle",
"crates/timeq",
"crates/tls-probe",
"crates/toml2jsonc",
"crates/traffic-gen",
"crates/tsa-daemon",
"crates/uuid-helper",
"crates/validate-bounces",
"crates/validate-shaping",
"crates/version-info",
]
resolver = "2"
[profile.release]
opt-level = 3
debug = 1 # include line tables for more meaningful backtraces
[workspace.dependencies]
ahash = "0.8.11"
amqprs = {version="2.0", features=["tls", "traces"]}
anyhow = "1.0"
arc-swap = "1.6"
async-stream = "0.3"
async-trait = "0.1"
aws-lc-rs = "1.13.1"
axum = "0.8"
axum-client-ip = "1.1"
axum-server = "0.7"
axum-streams = {version="0.23", features=["text"]}
backtrace = "0.3"
bitflags = "2.3"
bitstring = "0.2"
bytes = "1.0"
camino = "1.1"
caps = "0.5"
cgroups-rs = "0.3"
# Using a git ref until https://github.com/nickspring/charset-normalizer-rs/pull/45 is merged
charset-normalizer-rs = { git = "https://github.com/KumoCorp/charset-normalizer-rs.git", rev="1f1dc21b49d30d73a99b0136497352b569947ac2" }
chrono = { version = "0.4.26", default-features = false }
chrono-tz = {version="0.10", features=["serde"]}
cidr = {version="0.3", features=["serde", "bitstring"]}
clap = {version="4.5", features=["derive", "wrap_help"]}
clap-markdown = "0.1"
colorgrad = "0.7"
crc32fast = "1.5.0"
criterion = "0.7"
crossbeam-queue= "0.3"
crossbeam-skiplist= "0.1"
crossterm = { version = "0.28.0", features = ["event-stream"] } # sync with ratatui
dashmap = "6.1"
data-encoding = "2.6"
data-encoding-macro = "0.1"
deadpool = {version="0.12", features=["rt_tokio_1"]}
derive-where = "1.2.7"
ed25519-dalek = "2.0"
env_logger = "0.11"
fancy-regex = "0.16"
filenamegen = "0.2.7"
file_type = "0.8"
flume = "0.11"
foreign-types = "0.3" # sync with openssl
futures = "0.3.28"
futures-util = "0.3"
futures-lite = "2.3"
flate2 = "1.0"
gcd = "2.3"
gethostname = "1.0"
getrandom = "0.3"
git2 = { version = "0.20", default-features = false }
# handlebars uses a git ref until the next release is made, so that we have
# recursive lookup available.
handlebars = { version="6.3", git = "https://github.com/sunng87/handlebars-rust.git", rev="c349c39557700e6a5b5e5273f2fc0f42574b79f3" }
hdrhistogram = "7.5"
hex = "0.4"
# Be sure to update the link to the docs in docs/reference/kumo.dns/configure_resolver.md
# to match the version that we are using when you update this dep
hickory-resolver = "0.25"
hickory-proto = "0.25"
hierarchical_hash_wheel_timer = {version="1.2", default-features=false, features=["fx-hash"]}
human_bytes = "0.4.3"
humanize-rs = "0.1"
humantime = "2.1"
humansize = "2.1"
idna = "1.0.3"
incr_stats = "1.0"
indexmap = "2.2"
indoc = "2.0.5"
instant-xml = "0.5"
intrusive-collections = "0.9.7"
json_comments = "0.2"
itertools = "0.14"
jwalk = "0.8"
k9 = "0.12"
lapin = {version="2.5", default-features=false, features=["native-tls"]}
lexicmp = "0.2"
libc = "0.2.139"
linkme = "0.3"
libunbound = {git="https://github.com/KumoCorp/libunbound-rs.git", rev="19b39a551b3cf7cbc69a7eb24fef4801e66c6260"}
lipsum = "0.9"
log = "0.4"
lru-cache = "0.1"
mac_address = "1.1"
mail-builder = "0.2"
mailparse = "0.14"
maplit = "1.0"
map_vec = "0.6"
memchr = "2.5"
metrics = "0.24"
metrics-prometheus = "0.11"
metrics-tracing-context = "0.18"
minijinja = {version="2.7.0",features=["loader", "builtins", "json", "loop_controls"]}
minijinja-contrib = {version="2.7.0",features=["datetime", "pycompat", "rand", "textwrap", "unicode_wordwrap", "wordcount", "timezone"]}
mlua = "0.11"
nix = "0.30"
nom = "7.1.0"
nom_locate = "4.1"
notify = "8"
nucleo-matcher = "0.3"
num-format = "0.4.4"
openssl = { version="=0.10.72" } # pinned; see patch below
openssl-sys = { version="0.9" }
ordermap = {version="0.5", features=["serde"]}
parking_lot = "0.12"
pastey = "0.1"
percent-encoding = "2.3"
pest = "2.7"
pest_derive = "2.7"
ppp = "2.2"
prometheus = "0.14"
psl = "2.1.46"
quoted_printable = "0.5"
rand = "0.8"
ratatui = { version = "0.29.0", features = ["crossterm", "unstable-widget-ref"] }
rcgen = "0.13"
rdkafka = "0.38"
redis = {version="0.32", features=["cluster", "cluster-async", "connection-manager", "tokio-comp", "tls-native-tls", "tokio-native-tls-comp"]}
regex = "1.7"
reqwest = {version="0.12", default-features=false, features=["rustls-tls", "rustls-tls-native-roots"]}
ring = "0.17"
rmp-serde = "1.3.0"
rocksdb = {version="0.22", features=["jemalloc"]}
rustls = "0.23"
rustls-cert-gen = "0.2"
rustls-pemfile = "2.2.0"
rustls-platform-verifier = "0.5"
scopeguard = "1.2"
self_cell = "1.0"
serde = {version="1.0", features=["derive"]}
serde_bytes = "0.11"
serde_json = "1.0"
serde_path_to_error = "0.1"
serde_with = "3.4"
serde_yaml = "0.9"
sha-1 = { version = "0.10", features = ["oid"] }
sha2 = "0.10"
slog = "2.7"
smallvec = "1.13"
socksv5 = {version="0.3", default-features=false, features=["tokio"]}
sqlite = "0.37"
strum = { version = "0.27", features = ["derive"] }
tabout = "0.3"
tempfile = "3.10"
test-log = {version="0.2", features = ["trace"]}
testcontainers-modules = { version = "0.13", default-features = false }
textwrap = "0.16"
thiserror = "2"
tikv-jemallocator = {version="0.5", features=["background_threads", "stats"]}
tikv-jemalloc-ctl = {version="0.5", features=[]}
tikv-jemalloc-sys = {version="0.5", features=["profiling", "unprefixed_malloc_on_supported_platforms", "stats"]}
tokio = "1.32"
tokio-executor-trait = "2.1.0"
tokio-metrics = "0.4.5"
tokio-metrics-collector = "0.3.1"
tokio-openssl = "0.6.4"
tokio-reactor-trait = "1.1.0"
tokio-rustls = "0.26"
tokio-splice = "0.2"
tokio-stream = "0.1"
tokio-tungstenite = "0.28"
toml = "0.9"
toml_edit = "0.23"
tower-http = {version="0.6", features=["trace", "compression-deflate", "compression-gzip", "decompression-deflate", "decompression-gzip"]}
tracing = "0.1"
tracing-appender = "0.2"
tracing-subscriber = {version="0.3", features=["env-filter", "std", "fmt", "json"]}
tui-prompts = "0.5"
utoipa = {version="5", features=["axum_extras", "time", "uuid", "url", "chrono"]}
utoipa-rapidoc = { version="6.0", features = ["axum"] }
url = "2.4"
uuid = "1.4"
uuid-helper = { path = "crates/uuid-helper" }
vaultrs = "0.7"
walkdir = "2.3"
which = "8"
zstd = "0.13"
zstd-safe = {version="7.0", features=["std"]}
[patch.crates-io]
# Can be removed once dane support is upstreamed
openssl = { version="0.10.72", git="https://github.com/KumoCorp/rust-openssl.git", branch="dane-openssl-v0.10.72" }
# Can be removed once dane support is upstreamed
openssl-sys = { version="0.9", git="https://github.com/KumoCorp/rust-openssl.git", branch="dane-openssl-v0.10.72" }