fix(crypto): zeroize hpke's X25519 keys on drop #244
All Vouch review confidence checks passed
Residual risk 0.29 = Change Risk (0.69) × (1 − Review Confidence (0.58)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.69 · 456 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.366
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.069
Real PR Conversation Timeline
1 comments
"Review active on #244"
general
weight: 0.35
abendrothj
What and why
Fixes #245.
hpke 0.12 depends on
x25519-dalek2 withdefault-features = false, features = ["static_secrets"]. Nothing in the workspace or inbackend/fuzzturned on itszeroizefeature:cargo tree --workspace -e features -i x25519-dalek --lockedlisted onlystatic_secrets. Without that feature,StaticSecretandSharedSecretare plain[u8; 32]newtypes with no drop glue, so hpke's X25519 private key had noDropat all. That left the following freed without being wiped:ReleasedKeySession,DevKeyProvider,MultiTenantDevKeyProviderandEnclaveIdentity's HPKE key;This applies in the enclave and in the browser's wasm envelope module. README ("Status"),
docs/ARCHITECTURE.mdandkey_release.rsalready say these keys zeroize on drop.Changes:
platform-cryptogains a directx25519-dalek2 dependency. Its only job is to turn onzeroize, which Cargo unifies into hpke's copy. It lives in the crate, next to hpke's only user, rather than in the workspace dependencies.TenantKeypairimplementsZeroizeOnDrop. Its hand-writtenDropis removed: it assigned a zero key with a plain move, which the optimizer may remove as a dead store, andStaticSecretnow wipes itself with volatile writes.backend/Cargo.lockandbackend/fuzz/Cargo.lockchange by two lines each. No package is added or moved.This completes the key-material part of P52's zeroization item (#242). Since
TenantKeypairis nowZeroizeOnDrop, P52's PR (#243, stacked onp45) can assert that at the type level for the key sessions.#228 (X-Wing HPK2) upgrades to hpke 0.14.1, which turns on
zeroizefor x25519-dalek 3, x-wing and ml-kem itself, so its keys wipe on drop without this dependency. Whichever of the two lands second reconcilesplatform-crypto/Cargo.tomland both lockfiles. Once #228 is in, the directx25519-dalek2 line should go, because otherwise a second, unused x25519-dalek stays in the tree. The test should then point at hpke 0.14's key types.How it was tested
x25519_secrets_zeroize_on_drop. x25519-dalek 2.0.1 derives#[zeroize(drop)], which adds a zeroizingDropbut noZeroizeOnDropmarker. So the test asserts:-
ZeroizeonStaticSecretandSharedSecret;- at compile time,
needs_dropfor both and for hpke's own private key type. That last check fails if hpke ever links an x25519-dalek without the feature.main,needs_dropis false for hpke's X25519 private key, so the check fails to compile. With the feature removed again, the test fails to compile.cargo tree -e features -i x25519-dalek --lockedlistsstatic_secretsandzeroizefor the workspace, forbackend/fuzz, and forenvelope-wasmonwasm32-unknown-unknown.Checklist
scripts/check.shpasses locally. gitleaks is not installed here, so the secret scan was skipped; CI runs it.SECURITY_AUDIT_EVENTcovered byaudit_coverage.rs(no new runtime decisions)docs/DATA_POLICY.md)CHANGELOG.mdupdated for user-visible changes (CHANGELOG.mdunder Security; the docs already describe this behaviour)docs/adr/if one was made (none made)