Weak Random Number Generation in Security Context
Description
Detects use of Math.random() for security-sensitive operations like generating tokens, session IDs, or cryptographic keys. Math.random() is not cryptographically secure and can be predicted by attackers.
What Shoulder detects
How to fix
Replace Math.random() with cryptographically secure alternatives.
Applies to
Languages
Frameworks
express
fastify
References
Scan for this issue
Detect with Shoulder CLI
npx @shoulderdev/cli trust --rule=javascript-weak-random .