fix(crypto): crypto hardening — constant-time ops, type guards, error base class#454
Merged
ThePrismSystem merged 7 commits intomainfrom Apr 16, 2026
Merged
fix(crypto): crypto hardening — constant-time ops, type guards, error base class#454ThePrismSystem merged 7 commits intomainfrom
ThePrismSystem merged 7 commits intomainfrom
Conversation
Re-parent all 10 error classes under a shared CryptoError base to enable unified catch-all handling in consumers.
Narrow assertBoxSecretKey, assertBoxPublicKey, and assertSignSecretKey to branded asserts types for compile-time key safety.
…IT_SENSITIVE Use the branded KeyVersion type in getBucketKey to prevent accidental unvalidated number arguments. Add the 1 GiB sensitive memory limit constant for future server-side password hashing tiers.
Replace string !== with sodium.memcmp for the bucket ID check in parseEnvelope to prevent timing side-channels during grant validation.
Add @mustZero annotation to PasswordResetResult.masterKey and a new withMasterKeyFromReset wrapper that auto-zeroes both masterKey and authKey in a finally block after the callback completes.
… tests Capture the last error message as failureReason on failed items for diagnostic visibility. Add tests for partial success scenarios and mid-loop abort signal handling.
Propagate failureReason through CompletionItem, convert ItemProcessResult to a discriminated union, brand keyVersion in internal key-grant helpers, and strengthen test assertions.
ThePrismSystem
added a commit
that referenced
this pull request
Apr 17, 2026
Flip beans to completed whose scope was delivered but never reflected in status: - types-jmk7, types-11ux (PR #453) - crypto-r10c (PR #454) - sync-jj8q (PR #455) - ps-jdl9 (PR #456) - api-l6w0, api-m3up, api-nfo1, ps-kyu9 (PR #457) Each bean gets a Summary of Changes section pointing at the delivering PR and the verified code landmarks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
withMasterKeyFromResetfor automatic key zeroing after password resetassertsreturn types toassertBoxSecretKey/assertSignSecretKeykeyVersionparameter asKeyVersion, addPWHASH_MEMLIMIT_SENSITIVECryptoErrorbase class, re-parent all 10 error classesBeans
Completes
crypto-r10c(Phase 2 of M9 audit remediation).Test plan