Skip to content
vetkitChecksChangelogDocumentation

vetkit.js.crypto.insecure-random-token

Math.random() is used to generate a security-sensitive value (token, password, nonce...). It is predictable and not suitable for secrets.

Last updated:

Suite: Security

javascript, typescript

Math.random() is used to generate a security-sensitive value (token, password, nonce...). It is predictable and not suitable for secrets.

Category: SECURITY · Engine rule severity: WARNING

How to fix it

Use crypto.randomBytes / crypto.randomUUID / crypto.getRandomValues.

References

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