Skip to content

ADR-037: E2E encryption security review + design/implementation docs (E2E_ENCRYPTION.md) #155

Description

@cuttlefisch

Part of #131. A cryptographic-soundness gut-check + proper documentation of the E2E design, grounded in prior art, validating N-peer P2P scaling.

Deliverables

  • Design-level review (before more 3b code): multi-lens adversarial crypto review →
    docs/E2E_ENCRYPTION.md v1 + findings list.
  • Implementation-level review (after 3b/3c land, before 3d's confidentiality gate): verify the code
    matches the reviewed design.

Lenses (each grounded in primary-source prior art)

  1. AEAD usage — XChaCha20-Poly1305, 24-byte random nonce collision-resistance, key sizes, AAD/binding.
  2. Key wrap — sealed box (ephemeral X25519 ECDH → SHA-256 KDF → AEAD), Ed25519→X25519 birational map, KDF domain-sep + pubkey binding.
  3. encrypt-then-sign ordering / verify-before-decrypt (ADR-036/037).
  4. Key distribution + trust — genesis anchor, latest-owner-wrap-wins, signed-op-log integrity, forge/inject resistance.
  5. Removal/rotation §D3 — forward exclusion; explicit absence of FS/PCS (one symmetric key per KB until rotation).
  6. Metadata leakage to the key-blind daemon — ciphertext, op-ids (=SHA-256 of ciphertext), epoch client-ids, counts, timing.
  7. N-peer P2P scaling — O(N) sealed-box wraps per enable/rotation, op-set YMap merge at N, membership-DAG cost, rekey-on-churn.

Prior-art benchmark

MLS/TreeKEM (RFC 9420), Signal Sender Keys, Matrix Megolm, Keyhive/BeeKEM (Ink & Switch, ADR-037 §D4), CRDT-E2E (Jazz, Y-Sweet). Position our "single per-KB symmetric content key, sealed-box-wrapped to each member, distributed via the signed membership log, rotated on removal" honestly; confirm v1 (Sender-Keys-style, no FS/PCS) is a sound documented starting point with TreeKEM/BeeKEM as the named next step.

Outcome

Real bugs block the relevant PR (3b/3c); design limitations documented (not silently shipped). docs/E2E_ENCRYPTION.md: threat model, primitives, key lifecycle, what-is/isn't-protected, scaling analysis, prior-art table, findings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions