test(crypto): add bounded fuzz testing for encrypted envelope parsing… - #1800
Open
Anadudev wants to merge 2 commits into
Open
test(crypto): add bounded fuzz testing for encrypted envelope parsing…#1800Anadudev wants to merge 2 commits into
Anadudev wants to merge 2 commits into
Conversation
Collaborator
|
@Anadudev conflict |
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.
Closes #1724
Proposed Changes
Input Boundary & Resource Limits (
src/services/crypto/open-envelope.ts)openEnvelopeand helper functions before performing memory-heavy base64/hex decoding or SHA-256 digests:MAX_CIPHERTEXT_BASE64_LENGTH = 10 * 1024 * 1024(10 MB)MAX_FIELD_STRING_LENGTH = 8192(8 KB)MAX_ATTACHMENTS_COUNT = 100MAX_RAW_INPUT_STRING_LENGTH = 15 * 1024 * 1024(15 MB)OpenEnvelopeErrorwith safe public error codes (crypto_validation_error,crypto_parse_error,crypto_version_error,crypto_integrity_error,crypto_decryption_error).Fixed CI Fuzz Corpus & Bounded Mutation Tests (
tests/unit/crypto/fuzz.test.ts)Verification Plan
Automated Tests
npm testpassed 24/24 test files and 203/203 unit tests cleanly.fuzz.test.tspassed 29/29 tests in 99ms.npx eslintpassed with 0 errors.Manual Verification
OpenEnvelopeErrorexceptions are returned without exposing sensitive details.