-
-
Couldn't load subscription status.
- Fork 33.6k
crypto: protect against string collisions #60392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Review requested:
|
| validateStringWellFormed(val); | ||
| if (encoding === 'buffer') | ||
| encoding = 'utf8'; | ||
| return Buffer.from(val, encoding); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could also cause collisions on well-formed strings but encodings not capable of containing full Unicode
That should be addressed too
| validateStringWellFormed(buffer); | ||
| if (encoding === 'buffer') | ||
| encoding = 'utf8'; | ||
| return Buffer.from(buffer, encoding); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could also cause collisions on well-formed strings but encodings not capable of containing full Unicode
That should be addressed too
| Sign.prototype.update = function update(data, encoding) { | ||
| if (typeof data === 'string') { | ||
| validateEncoding(data, encoding); | ||
| validateStringWellFormed(data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see other comments about encoding, this might also need adjustments and/or a check on src/ side
|
|
||
| if (typeof data === 'string') { | ||
| validateEncoding(data, encoding); | ||
| validateStringWellFormed(data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto about encoding
Includes #60384
Closes: #60267
This is a draft.
Feedback is welcome though