Skip to content
vetkitChecksChangelogDocumentation

vetkit.ruby.crypto.insecure-random-token

A token, password, salt or nonce is generated with a non-cryptographic random source (rand / Random / Array#sample / shuffle), so it can be predicted.

Last updated:

Suite: Security

ruby

A token, password, salt or nonce is generated with a non-cryptographic random source (rand / Random / Array#sample / shuffle), so it can be predicted.

Category: SECURITY · Engine rule severity: WARNING

How to fix it

Use SecureRandom (SecureRandom.hex / urlsafe_base64 / alphanumeric) or has_secure_token.

References

Source: packages/engine/rules/sast/ruby.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.