-
Notifications
You must be signed in to change notification settings - Fork 6
Use cryptographically-secure random number generator #63
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
Comments
But cryptographically-secure is... pseudo-random also 🙃 |
I believe the point here is that it is possible to predict values from crypto insecure generator by observing long enough sequence of previously generated values . In other words, when intruder is able to observe sequence of generated values (even expired one), then he can derive the state of generator from them and thus to start to generate its own values that will be accepcted by the system. As a result, it will compromise users security. This issue does not appear when you use cryptographically safe algo as doc states. |
Related to diia-open-source/be-auth-service#1 |
FYI @AndriiDubonos this issue would be closed if this PR is accepted: |
Hi @AndriiDubonos |
Current implementation for OTP generation use
Math.random()
for random number generation.It's pseudo-random and should not be used as a number generator in security environment.
be-user-service/src/services/otp.ts
Line 31 in b45a0e2
The text was updated successfully, but these errors were encountered: