VBC-001: hardcoded-secret
errorCategory: core
Analysis: Regex (line by line)
File types: .js, .ts, .tsx, .py, .env, .yaml, .yml, .json, .astro
Scope: source code only, ignoring anything inside strings and comments
Excluded paths: **/test/**, **/tests/**, **/__tests__/**, **/testdata/**, **/fixtures/**, **/test_*.py, **/*_test.py, **/test.py, **/conftest.py, **/*_test.go, **/*_bench.go, **/*.test.*, **/*.spec.*
Tags: security secrets
What it reports
Hardcoded credential at line {line}. Read it from the environment. Values that name what they are, such as CHANGEME or a fixture spelling out "secret", are not reported: they describe a field rather than hold a key.
Flagged
js
AWS_SECRET_ACCESS_KEY = "wJalrXUtnFEMI/K7MDENG/bPxRfiCY"js
const password = "hunter2abc";js
api_key: "A9dK2mQ7xR4vL8nP1sT6wY3z"js
token = "ghp_9fK2mQ7xR4vL8nP1sT6wY3zB5cE0"Not flagged
js
PASSWORD = "correct horse battery staple"js
api_key = "lm-studio"js
secret = "user-message-content-visible-in-trace"js
const secretary = "Ada Lovelace 1843"js
const password = process.env.PASSWORD;js
const token = "";js
secret = "REAL-HMAC-SECRET"js
api_key: "your-api-key-here"js
access_key = "AKIAIOSFODNN7EXAMPLE"js
const TAM_TOKEN_ADDRESS = '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512';js
token_address = "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"Pattern
regex
(?<![A-Za-z])(api_key|secret|password|passwd|token|bearer|auth[_-]?key|access[_-]?key)(?![A-Za-z])[\w]*(?<![_-]addr)(?<![_-]address)\s*[:=]\s*['"\`](?![^'"\`]*(?:secret|password|passwd|token|apikey|api[_-]?key|credential|dummy|example|sample|test|fake|changeme|placeholder|your[_-]|xxx|\.\.\.))(?=[^'"\`]*\d)(?![^'"\`]* )([^'"\`]){8,}