scar-003 · scar
Hardcoded secret
A key or password was written directly in source code and ended up in version control.
Before and after
Before · the mistake
1const API_KEY = "sk_live_abcdef123456"After · the rule
1Read it from the environment: const API_KEY = process.env.API_KEYHow it’s detected
/(api_?key|secret|token|password)\w*\s*=\s*["'][A-Za-z0-9_\-]{12,}["']/iTimes it came back
This mistake has not been repeated. The rule is working.