crypto: align WebCrypto error behavior with specs - #65550
Open
panva wants to merge 3 commits into
Open
Conversation
Let OpenSSL handle representable salt lengths so verification of an impossible length resolves false. Guard values outside the native int32 parameter range to prevent SignJob from silently ignoring them. Move the digest-size helper next to HKDF, its remaining consumer. Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Reject SPKI export of a private asymmetric key with InvalidAccessError as required by the algorithm export steps. Let wrapKey propagate the same export failure. Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Check requested usages against the JWK public or private key type before validating key_ops. This preserves the SyntaxError precedence specified for RSA, EC, CFRG, ML-DSA, and ML-KEM imports. Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Collaborator
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65550 +/- ##
=======================================
Coverage 90.13% 90.13%
=======================================
Files 751 751
Lines 253639 253641 +2
Branches 47790 47794 +4
=======================================
+ Hits 228618 228622 +4
+ Misses 16264 16258 -6
- Partials 8757 8761 +4
🚀 New features to boost your workflow:
|
avivkeller
approved these changes
Aug 26, 2026
jasnell
approved these changes
Aug 26, 2026
This comment has been minimized.
This comment has been minimized.
Collaborator
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.
This aligns three WebCrypto behaviors with their specifications:
saltLengthnow resolvesfalsewhile signing continues to reject withOperationError(WebCrypto, RFC 8017).InvalidAccessError, including throughwrapKey(), as required by the export steps.key_ops, soSyntaxErrortakes precedence when both are invalid (RSA-PSS, ECDSA, ML-KEM).