final-approval audit fixes: HIGH-1/2/3
Three findings from the post-cleanup approval audit, all blockers
before the rename to a real codename:
HIGH-1: ReadOutput.headers map kept LAST occurrence of duplicate
headers, not FIRST. Comment said 'keep the first occurrence' but the
code used Message::header_raw(name) which internally does
.iter().rev().find(...) — returns the last one. For load-bearing
headers like References this is usually singular so the bug was
latent, but an attacker who could inject a second References: line
would have gotten to override the first one used by mail_reply for
threading. Switched to parsed.headers_raw() which iterates in arrival
order — first-occurrence guaranteed.
HIGH-2: tokio-rustls default features pulled aws-lc-rs + aws-lc-sys
into the dep tree even though we explicitly went ring-only on rustls.
The default feature chain on tokio-rustls v0.26 enables 'aws_lc_rs'
via rustls. Pinned tokio-rustls to default-features=false and the
matching small feature set: logging, tls12, ring. Verified via
`cargo tree` — no aws-lc-* in the build, single ring v0.17.14
shared between rustls + tokio-rustls. ~9s shorter cmake step in cold
builds, smaller binary, no C-FFI crypto surface area.
HIGH-3: IntoMcpError trait was introduced in the cleanup pass but
applied at only 2 of 10 tools — the other 8 still used the manual
.map_err(|e| format!('{e:#}'))? + serde_json::to_string chain.
Maintenance trap. Applied to_mcp() at all 8 sites
(mail_inbox_list, mail_folder_list, mail_search, mail_thread,
mail_attachment_get, mail_inbox_read; mail_move and mail_mark stay
with literal {"ok":true} returns — no value to serialize). Tool
methods are now uniformly:
imap_mod::xxx(...).await.to_mcp()
or for the few that need pre-arg work, three lines instead of seven.
Wire smoke verified — read on uid 34 returns the same 13 headers
shape, no empties, all canonical fields populated. cargo test 31/31.
Repo chain: 2240bf7 -> 4251f51 -> f4b3199 -> 6432a1f -> 54a1a6b ->
6fb63b0 -> f7e698b -> b681953 -> 7c8e246 -> this.
This commit is contained in:
parent
7c8e246544
commit
5e1c63eeaa
4 changed files with 30 additions and 112 deletions
|
|
@ -37,7 +37,10 @@ lettre = { version = "0.11", default-features = false, features = [
|
|||
# IMAP — async-imap is tokio-native and supports UID-based addressing
|
||||
# (which we use throughout the API surface).
|
||||
async-imap = { version = "0.10", default-features = false, features = ["runtime-tokio"] }
|
||||
tokio-rustls = "0.26"
|
||||
# tokio-rustls default-features pulls in aws-lc-rs via rustls's default
|
||||
# feature chain. We use `ring` exclusively (installed once in main.rs);
|
||||
# turn off defaults and add back only the small pieces we want.
|
||||
tokio-rustls = { version = "0.26", default-features = false, features = ["logging", "tls12", "ring"] }
|
||||
rustls = { version = "0.23", default-features = false, features = ["std", "tls12", "ring"] }
|
||||
rustls-pki-types = "1"
|
||||
webpki-roots = "0.26"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue