-
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
Possible regression with crypto.randomBytes(size, null) #16778
Comments
cc @jasnell |
Personally I don't think it's a regression because |
Yeah I likely should have called that out in the notable changes because it is hidden. This was actually somewhat intentional to make the type validation tighter. |
Ok makes sense. I think calling it out explicitly in the changelog would be useful. |
Fixes: #16778 PR-URL: #17594 Fixes: #16778 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
The
crypto.psuedoRandomBytes(...)
andcrypto.randomBytes(...)
functions throw an ERR_INVALID_CALLBACK if the second parameter isnull
. In prior versions anull
value for the second parameter would be treated the same as undefined causing the function to be invoked as if it had been invoked with just one parameter, i.e.crypto.randomBytes(size)
.Reproduce via:
#16454 introduced the parameter validation change that is causing this.
I'm not sure if this should be considered a regression as the function is being invoked with two arguments (i.e.
null
where a callback is expected) but I didn't see anything in the changelog about it though so not sure if it was overlooked.The text was updated successfully, but these errors were encountered: