You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// === Client side ===
const crypto = window.crypto || window.msCrypto;
var array = new Uint32Array(1);
crypto.getRandomValues(array); // Compliant for security-sensitive use cases
// === Server side ===
const crypto = require('crypto');
const buf = crypto.randomBytes(1); // Compliant for security-sensitive use cases
How to reproduce it (as minimally and precisely as possible):
Run Sonarqube scan on the project
Full logs to relevant components
From Sonarqube output:
Using pseudorandom number generators (PRNGs) is security-sensitive. For example, it has led in the past to the following vulnerabilities:
CVE-2013-6386 CVE-2006-3419 CVE-2008-4102
When software generates predictable values in a context requiring unpredictability, it may be possible for an attacker to guess the next value that will be generated, and use this guess to impersonate another user or access sensitive information.
As the Math.random() function relies on a weak pseudorandom number generator, this function should not be used for security-critical applications or for protecting sensitive data. In such context, a cryptographically strong pseudorandom number generator (CSPRNG) should be used instead.
This way of generating the random numbers is flagged 4 times.
The text was updated successfully, but these errors were encountered:
Thanks for your bug report. It sounds like this is only affecting the tests? I'm not sure we really care, but if you want to fix it feel free to open a PR. Thanks!
Versions of relevant software used
grpc-web 0.14.1
What happened
Possible unsafe use of Math.random() pseudorandom number generator.
This project uses Math.random() like this:
What you expected to happen
Sonarqube recommends:
How to reproduce it (as minimally and precisely as possible):
Run Sonarqube scan on the project
Full logs to relevant components
From Sonarqube output:
Using pseudorandom number generators (PRNGs) is security-sensitive. For example, it has led in the past to the following vulnerabilities:
CVE-2013-6386
CVE-2006-3419
CVE-2008-4102
When software generates predictable values in a context requiring unpredictability, it may be possible for an attacker to guess the next value that will be generated, and use this guess to impersonate another user or access sensitive information.
As the Math.random() function relies on a weak pseudorandom number generator, this function should not be used for security-critical applications or for protecting sensitive data. In such context, a cryptographically strong pseudorandom number generator (CSPRNG) should be used instead.
This way of generating the random numbers is flagged 4 times.
The text was updated successfully, but these errors were encountered: