← Back to Pull requests

docs: add ADR 0007 hybrid suite construction #110

Closed
unknown closed this pull request without merging on Oct 21, 2026 15:07 UTC
View on GitHub
unknown unknown commented on Oct 19, 2026 20:32 UTC
Author

Closes #41 (P17) once the ADR is Accepted.

What

New docs/adr/0007-hybrid-suite-construction.md, Status: Proposed. Acceptance is @AxolDad's call; please flip it to Accepted in this PR before merging, or leave review comments. It records:

  • KEM: HPKE base mode, X-Wing (KEM 0x647a) pinned to draft-connolly-cfrg-xwing-kem-06 (what RustCrypto x-wing 0.1.1 implements), HKDF-SHA256, AES-256-GCM.

  • Frame and info: HPK2 ‖ enc(1120) ‖ ct, mapping to exactly that suite; -v2 info kinds for connector objects, snapshot manifests, P38 uploads and P55 results.

  • Libraries: hpke 0.14.1 on the backend and, built for wasm32 (P34's wrapper), in the browser. JavaScript libraries are used only to generate vectors, so CONTRIBUTING.md is unchanged.

  • Interop proof: KEM-level known-answer tests against @noble/post-quantum, plus committed suite vectors in both directions against hpke-js.

  • Browser key storage: the 32-byte seed is encrypted under a dedicated non-extractable AES-GCM key, with an AAD binding to tenant and key fingerprint. It is decrypted only in the worker and zeroized after use. The residual risk is stated.

  • Signatures in v1: tokens follow ADR 0006 (#40); "attestation-bound material" is defined (result-signing and manifest-signing keys held only by an attested workload); third-party classical chains are out of scope.

  • "Established": a stated definition replaces "audited", with each library's audit status recorded as an accepted risk.

  • Migration: no HPK1 migration mode in v1; this supersedes ADR 0001's migration consequence for v1.
  • docs/ARCHITECTURE.md (suite table, migration rules), docs/THREAT_MODEL.md (A4, out of scope), docs/PROJECT_SCOPE.md (stack line), docs/adr/README.md and CHANGELOG.md are updated. If the ADR is not accepted as written, these edits change with it.

    Spike (2026-10-19, Rust 1.94.1, outside the repo)

    | Check | Result |
    | --- | --- |
    | hpke 0.14.1 X-Wing/HKDF-SHA256/AES-256-GCM, native | Round trip; seed 32 B, pk 1216 B, enc 1120 B |
    | Same code for wasm32-unknown-unknown | Builds; 142 KB, 47 KB gzipped (no bindgen glue). Not run in a browser yet |
    | Rust x-wing 0.1.1 vs @noble/post-quantum 0.7.1 | Identical pk, ciphertext and shared secret from the same seed and randomness; cross-decapsulation works |
    | Rust hpke 0.14.1 vs hpke-js (@hpke/core 1.9.0 + @hpke/hybridkem-x-wing 0.7.0) | Each opens the other's frame; both report KEM id 0x647a |
    | noble X-Wing bundle | 46 KB, 18 KB gzipped (KEM only, no HPKE) |

    Needs a maintainer decision

    1. Pin draft-06 (matches the RustCrypto crate; the -07 to -10 change log has no wire changes and the interop above confirms the bytes)?
    2. hpke-js as the second implementation for committed vectors?
    3. Accept the definition of "established" in place of "audited"?
    4. Cloud KMS (ADR 0004 option A) returns an X-Wing shared secret, not an HPKE context. This ADR deliberately does not invent a construction for KMS-wrapped data keys; that stays with ADR 0004's open question 3.
    5. ADR 0004 says the researcher's result key is non-extractable, which an X-Wing seed cannot be. ADR 0004 needs that wording changed before acceptance (coordinate with #38).

    Diff: 405 lines (+303 / -102) across 5 files Reviewer: abendrothj Review duration: 2555m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 405 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.359
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #110"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 44.8% (MEDIUM) · Higher = larger blast radius
    44.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.7% · Safe to merge
    17.7%