Zum Inhalt springen

Weak Random (ARCH8115)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Key kotlin.security.weak-random · Severity warning · Category security · CWE CWE-338

Flags java.util.Random, kotlin.random.Random or Math.random used for tokens, keys, nonces or passwords.

val token = Random.nextInt().toString(16)
val token = ByteArray(32).also { SecureRandom().nextBytes(it) }.toHex()

Use SecureRandom for anything security-sensitive.