crypto: validate RSA-PSS saltLength in subtle.sign and subtle.verify#52262
Merged
nodejs-github-bot merged 1 commit intonodejs:mainfrom Apr 3, 2024
Merged
Conversation
Collaborator
|
Review requested:
|
lpinca
approved these changes
Mar 29, 2024
Collaborator
Collaborator
Collaborator
anonrig
reviewed
Mar 29, 2024
| const type = mode === kSignJobModeSign ? 'private' : 'public'; | ||
|
|
||
| if (key.type !== type) | ||
| throw lazyDOMException(`Key must be a ${type} key`, 'InvalidAccessError'); |
Member
There was a problem hiding this comment.
The error is not sync anymore. Does this make this semver-major change?
Member
Author
There was a problem hiding this comment.
It does not. The entire API surface of webcrypto is async functions.
| case 'SHA-1': return 20; | ||
| case 'SHA-256': return 32; | ||
| case 'SHA-384': return 48; | ||
| case 'SHA-512': return 64; |
Member
There was a problem hiding this comment.
Can you add a default with unreachable (like throw error)
Member
Author
There was a problem hiding this comment.
It's done the same way as the method above. I don't feel it's necessary. Used hashes are verified far before this is ever invoked.
tniessen
approved these changes
Apr 2, 2024
anonrig
approved these changes
Apr 3, 2024
Collaborator
|
Landed in 2241e8c |
Merged
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.
Resolves a TODO from @jasnell to validate RSA-PSS saltLength in SubtleCrypto.sign and SubtleCrypto.verify
fixes: #52188