A SecureRandom is requested with the SHA1PRNG algorithm, whose output can be predictable when seeded

tx0/kotlin:sha1prng-secure-randomrecommendedwarningsecurity/cryptodepth fastsecurity, cwe-338

What it finds

SecureRandom.getInstance("SHA1PRNG") gives a generator that becomes deterministic when it is seeded before use, and its implementations have had flaws on Android. SecureRandom() picks the strongest source of the platform.

From the rule's source, sha1prng_random.rs.

Example from the rule's tests
fun random() {    val a = SecureRandom.getInstance("SHA1PRNG")tx0 reports: SHA1PRNG can give predictable numbers    val b = SecureRandom.getInstanceStrong()    val c = SecureRandom()}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/kotlin:sha1prng-secure-random" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/kotlin:sha1prng-secure-random] reason="..."

tx0 explain tx0/kotlin:sha1prng-secure-random shows the same in the terminal. Found a false positive? Report it.