Skip to content
vetkitChecksChangelogDocumentation

vetkit.swift.crypto.insecure-random-secret

A token, password, OTP, salt or key is generated with the C library rand()/random()/drand48(), which are predictable (and often seeded with the time).

Last updated:

Suite: Security

swift

A token, password, OTP, salt or key is generated with the C library rand()/random()/drand48(), which are predictable (and often seeded with the time).

Category: SECURITY · Engine rule severity: WARNING

How to fix it

Use SecRandomCopyBytes or SystemRandomNumberGenerator (Int.random(in:), UInt8.random(in:)).

References

Source: packages/engine/rules/sast/swift.yml.

Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.