-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
crypto: throw proper errors if out enc is UTF-16 #12752
Conversation
Throw `Error`s instead of hard crashing when the `.digest()` output encoding is UTF-16. Fixes: nodejs#9817
cc/ @nodejs/crypto |
The doc says that only the following three encoding can be accepted. The encoding can be 'hex', 'latin1' or 'base64' Is it better to have white-listed check rather than having only UCS2 check? |
@shigeki Yeah, those are the only encodings that actually make some sense here, so whitelisting sounds okay to me; that would be a breaking change, though. |
I think that only |
Landed in 6c2daf0 |
Throw `Error`s instead of hard crashing when the `.digest()` output encoding is UTF-16. Fixes: #9817 PR-URL: #12752 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Throw `Error`s instead of hard crashing when the `.digest()` output encoding is UTF-16. Fixes: nodejs#9817 PR-URL: nodejs#12752 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Throw `Error`s instead of hard crashing when the `.digest()` output encoding is UTF-16. Fixes: #9817 PR-URL: #12752 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Landed this on v6.x, seems reasonably safe (node was previously hard crashing so it shouldn't get much worse). LMK if this was a mistake. |
Throw `Error`s instead of hard crashing when the `.digest()` output encoding is UTF-16. Fixes: #9817 PR-URL: #12752 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Throw `Error`s instead of hard crashing when the `.digest()` output encoding is UTF-16. Fixes: #9817 PR-URL: #12752 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Throw
Error
s instead of hard crashing when the.digest()
outputencoding is UTF-16.
Fixes: #9817
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
crypto