You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Harden @adonisjs-lasagna/crypto against the frozen design (01-crypto / 00-foundation)
without reshaping the RC surface. All changes are additive (no major bump, contract
version unchanged).
Correctness & fail-closed (WS-0):
- shred: serialize the destructive section (bounded jittered backoff → retriable
`shred_in_progress`; Redis-down still fail-open) AND treat shredLive()'s return as
authoritative, so a lost race yields `alreadyShredded` with no double WORM audit or
duplicate SubjectShredded (§6.6). Ledger-absent check consolidated once before the lock.
- rekek: new `shreddedDuringRewrap` bucket so the accounting invariant is exact
(scanned = current + rotated + shreddedDuringRewrap + failed).
- pg store: INSERT ... RETURNING fails closed (`insert_failed`) instead of a non-null bang.
KeyProvider extensibility + SSRF (WS-1):
- KeyProvider gains optional `contractVersion`; registry.register() enforces it via
assertContractCompat (AI/billing parity).
- new HttpKeyProvider base routes every egress through core safeFetch (T13 by
construction) + reference VaultKeyProvider (transit engine); raw KEK bytes never enter
the process.
- new structural guard check-crypto-invariant-11 forbids raw egress outside
http_key_provider.ts and requires the base to route through safeFetch (presence FLOOR).
- WORM ledger connection name resolved from config (was hardcoded 'backoffice').
Framed enc_v2 stream envelope §6.8 (WS-2):
- sealFramedV2 / openFramedV2 (+ streaming variants): a composition of core's per-frame
seal, not a new cipher (I1). Frame index rides the authenticated keyId; a counted
terminator seals the frame count. Strict-open rejects reorder / drop / duplicate /
cross-stream / truncation / tamper and never returns partial plaintext.
TypeScript rigor (WS-3):
- mixin hooks typed EncryptableModel, decorator options generic <TRow>, command catches
narrowed to unknown.
Tests & coverage (WS-4):
- split the shred spec into the design-named files; add concurrent-race, rekek/worm-ledger
accounting, KMS-down, SSRF-blocked, framed-envelope matrix, contractVersion gate, and
real-PG crash/governance-absent specs (+ gated real-Vault smoke).
- unit coverage floors 84/80/84 → 91/85/90/91 (measured 93.8/87.6/92.6); minMergedCoverage
60/60/60 → 80/80/75; worm_shred_ledger removed from c8 excludes.
Docs (WS-5):
- fix encryptedColumnCheckSql example drift (positional, not object), Mermaid key
hierarchy, rowscope/CHECK callouts, EncryptedRepository controller example, OLD_APP_KEY
.env note, Custom-KeyProvider expansion, @searchable post-shred JSDoc, CHANGELOG,
tests/README T1..T14 map.
0 commit comments