How secret detection works: key names and value shapes
One line: key names are matched word by word and values by fixed service prefixes; both are probabilistic, so review the result.
Key-name heuristics
The key is split on underscores, dots and camel-case boundaries into words, and any risky word marks the value as secret. AUTH must not match OAUTH or AUTHOR, so the comparison is per word rather than a substring.
GITHUB_TOKEN splits into GITHUB and TOKEN and matches. MONKEY and AUTHOR_NAME do not.
| Word | Matches | Does not match |
|---|---|---|
| TOKEN | SLACK_BOT_TOKEN | TOKENIZER_MODEL |
| KEY | STRIPE_SECRET_KEY | MONKEY |
| PASSWORD / PWD | DB_PASSWORD, MYSQL_PWD | PASSWORDLESS_MODE |
| AUTH | BASIC_AUTH_HEADER | OAUTH_CLIENT_ID, AUTHOR |
| DSN | SENTRY_DSN | — |
| PRIVATE | PRIVATE_KEY_PATH | PRIVACY_URL |
Value patterns
Even with a harmless name, a value with a service-specific shape is a secret. Tokens with a fixed prefix produce few false positives.
| Service | Shape |
|---|---|
| JWT | eyJ… .eyJ… .signature |
| AWS | AKIA or ASIA plus 16 characters |
| GitHub | ghp_, gho_, ghu_, ghs_, ghr_, github_pat_ |
| Slack | xoxb-, xoxp- and hooks.slack.com/services/… |
| Stripe | sk_live_, sk_test_, rk_, whsec_ |
| OpenAI / Anthropic | sk-, sk-proj-, sk-ant- |
| AIza plus 35 characters | |
| PEM / PGP / SSH | -----BEGIN … PRIVATE KEY----- |
| Database URL | postgres://user:pass@, mysql://, mongodb+srv:// |
False positives and misses
False positives come from public values (NEXT_PUBLIC_) and documentation dummies. Misses come from unfamiliar formats, meaningless key names and list items.
In a Kubernetes Secret, env: [{name: DB_PASSWORD, value: …}] keeps the name and the value in different entries, so key-name detection is weak. Add the parent key to the blacklist for those files.
Using this in production
Detection rules differ between tools. Run a secret scanner such as GitHub secret scanning or gitleaks in the repository, and add a human look in this workbench right before sharing.
When rules change, re-check snippets you shared earlier. Changing a rule protects new values; it does not fix an old leak.
Questions
Why skip public keys?
NEXT_PUBLIC_ and VITE_ values ship in the browser bundle, so masking them adds nothing and clutters the list.
When should I enable the random-string check?
When you are hunting internal tokens without a known format. It targets 20+ character mixes of letters and digits, so it also catches short IDs and hashes.
Sources
Every example here can be pasted into the workbench as it is.
Open the workbench