opyeb envmask

How secret detection works: key names and value shapes

2026-11-29 · 2 min read

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 matching examples
WordMatchesDoes not match
TOKENSLACK_BOT_TOKENTOKENIZER_MODEL
KEYSTRIPE_SECRET_KEYMONKEY
PASSWORD / PWDDB_PASSWORD, MYSQL_PWDPASSWORDLESS_MODE
AUTHBASIC_AUTH_HEADEROAUTH_CLIENT_ID, AUTHOR
DSNSENTRY_DSN—
PRIVATEPRIVATE_KEY_PATHPRIVACY_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.

Common value patterns
ServiceShape
JWTeyJ… .eyJ… .signature
AWSAKIA or ASIA plus 16 characters
GitHubghp_, gho_, ghu_, ghs_, ghr_, github_pat_
Slackxoxb-, xoxp- and hooks.slack.com/services/…
Stripesk_live_, sk_test_, rk_, whsec_
OpenAI / Anthropicsk-, sk-proj-, sk-ant-
GoogleAIza plus 35 characters
PEM / PGP / SSH-----BEGIN … PRIVATE KEY-----
Database URLpostgres://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