Will It Vibe logoWill It Vibe?
GO-003Medium severity-8 points

math/rand used for a security-sensitive value

Part of Security, which counts for 30% of the overall score. When this check fires it deducts 8 points from that category, once per scan, no matter how many places it turns up.

What it detects

A value assigned to a variable named like a token, session id, password, or secret is generated with math/rand instead of crypto/rand, so the value is predictable from the generator seed rather than cryptographically random.

Why it matters

math/rand is a fast, deterministic pseudo-random generator seeded from a small, guessable state; it was never designed to resist prediction. A token, session id, password, or similar value generated from it can be predicted or brute-forced by anyone who can observe a few outputs or knows roughly when the process started, letting them forge another user's session or guess a secret outright.

How to fix it

Use crypto/rand for anything security-sensitive: read random bytes with rand.Read(buf) or generate a random big.Int with rand.Int, then encode the result (hex or base64) for use as a token. Keep math/rand for non-security randomness such as jitter, sampling, or test data, where predictability does not matter.

The paid report includes a ready-to-paste prompt for your AI coding agent for every check it finds, pointed at the exact findings from your scan. See pricing

Does your repo trip this check?

Paste a GitHub URL or drop a project folder. Scans run in your browser and take seconds.

Scan your repo

Related Security checks