Insecure java.util.Random for a security value
Part of Security, which counts for 30% of the overall score. When this check fires it deducts 8 points from that category, once per scan, no matter how many places it turns up.
What it detects
new Random() (or Math.random()) is used on a line naming a token/secret/session/nonce. java.util.Random is predictable; use java.security.SecureRandom. This is a proximity heuristic.
Why it matters
java.util.Random (and Math.random, which uses it) is a linear congruential generator whose sequence is predictable once a couple of outputs are seen. Tokens, session ids, or keys from it can be forged. This is a proximity match against security wording on the line.
How to fix it
Use java.security.SecureRandom for security values, obtained via SecureRandom.getInstanceStrong() or the default constructor, and generate bytes with nextBytes. Keep java.util.Random for simulations and shuffling of non-sensitive data. Reuse a single SecureRandom instance rather than creating one per call.
The paid report includes a ready-to-paste prompt for your AI coding agent for every check it finds, pointed at the exact findings from your scan. See pricing
Does your repo trip this check?
Paste a GitHub URL or drop a project folder. Scans run in your browser and take seconds.
Scan your repo