feat(enclave): add the attestation foundation for sealed queries and results #249
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.50) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 565 lines diff across 7 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.379
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #249"
general
weight: 0.35
abendrothj
What and why
Part of #176 (P85) and #177 (P55): the base both build on, so they can go ahead in parallel (#183). ADR 0010 decides the design; this PR builds the parts that don't yet change behaviour.
Closes #39.
platform-crypto): Ed25519 and ML-DSA-65 together, both required (ADR 0007), over ADR 0010's domain-separated message. ML-DSA signs deterministically with an empty context. Keys come from zeroized seeds;Debugprints neither.research_queryinfo string and query binding (thequeryfield ofresearch_result), in Rust, the wasm module and the TS wrapper, pinned infixtures/envelope/hpk1.json.platform-enclave):EnclaveKeyBindingreplacesReportDataBinding's fixed 32-byte fields with ADR 0010's labelled, length-prefixed values.EnclaveIdentity): anHPK2request key, with its private half now in every build, and a result-signing key, with akey_id.GET /api/v1/attestationtakes the caller's nonce as?nonce=(32 bytes, base64url; 400 when it is missing or malformed) and returns ADR 0010's evidence bundle (v1'splatformandconfig_digestfields go; the browser recomputes the config digest from the token). The dev key-release stand-in checks binding v2 and refuses a request key that is notHPK2, audited ascrypto.suite_refused. The bundle's token carries the browser audience (urn:platform:browser-attestation), which key release refuses.Debugand wiped on drop (best-effort; see ADR 0010), also when a later field fails to parse.parse()refuses more than 64 KiB before decoding.Left for P85: exact nonce matching in
TokenVerifier, the config digest from the environment (until then, withENCLAVE_CONFIG_DIGEST_HEXset, a client can't recomputekey_id), the replay store, the command-line checker and the threat-model rows. Left for P55: sealing and the signed response.GET /api/v1/attestation's 400 is input validation on an unauthenticated route, so it emits no audit event (ARCHITECTURE, Security telemetry, rule 2).Stacked on #228; #233 is stacked on this.
New dependency:
ml-dsa0.1.2 (RustCrypto, Apache-2.0 OR MIT, named in ADR 0007; passescargo deny).ed25519-dalek2.2 was already in the tree throughjsonwebtokenand is now a direct dependency.platform-apiturns onzeroize'sserdefeature for the SQL field.For reviewers: the request key is now
HPK2, while the browser module sealsHPK1until P36 (#186), so P85's browser half (#239) waits on P36 or widens the module.How it was tested
key_id, both query bindings, and the signature message.infoand frame, another key, and wrong lengths.crypto.key_releasedenial; a token correctly bound to anHPK1request key is refused with 403 and bothcrypto.key_releaseandcrypto.suite_refused(the test fails under the development suite policy and passes under production).crypto.key_releasedenial; a browser token minted over HTTP passes only the browser verifier; a sealed query plaintext over 64 KiB is refused before decoding.Debugoutput.scripts/check.shpasses, andbackend/fuzzbuilds with--locked. CI runsscripts/test-simulated-tee.sh.Checklist
scripts/check.shpasses locallySECURITY_AUDIT_EVENTcovered byaudit_coverage.rs(the stand-in's refusals use itscrypto.key_releasedenials, and theHPK2check also emitscrypto.suite_refused)docs/DATA_POLICY.md)CHANGELOG.mdupdated for user-visible changesdocs/adr/if one was made (ADR 0005 and ADR 0010 accepted)