-
Notifications
You must be signed in to change notification settings - Fork 53
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
Use Math.random when debugger is attached #8
Conversation
Normally this calls a synchronous native method, which is more secure and of course the point of this library, but calling synchronous native methods is not supported when the debugger is attached.
@TheAlmightyBob thank you for this! I added two commits to 1) warn when the insecure RNG is used, and 2) make sure that it's only used when running in the debugger, Would you mind reviewing my two commits? ❤️ |
@LinusU Nice! Those changes both look good to me. |
And especially thanks for reminding me that |
Yeah, we can potentially ease up on it in the future, I just want to be very sure that we aren't using an insecure RNG somewhere we shouldn't... If this is also just happening in VS Code as you indicated, we could potentially fix it upstream there so that this isn't needed at all :) In fact, the best fix to get rid of the warning is probably to implement |
Thanks! Released as 🚢 1.4.0 / 2020-04-20 |
I sort of agree, but:
|
Normally this calls a synchronous native method, which is more secure and of course the point of this library, but calling synchronous native methods is not supported when the debugger is attached.
AFAIK this only affects VSCode. Debugging with Chrome or React Native Debugger bypasses this library altogether, in favor of their
global.crypto.getRandomValues
. VSCode does not provideglobal.crypto
.The
Math.random
logic here is directly copied from previous versions of https://github.com/uuidjs/uuid, before they removed it (and encouraged the use of this library).