Error
A hardcoded password was found in the code.
Why this matters
Anyone with repository access can see passwords stored in code. Git history preserves them even after you delete them. Hardcoded passwords also tend to get reused across systems, so one leak can compromise several services.
Detected patterns
Patterns that trigger this error:
password = "secret123"
passwd: 'mypassword'
pwd='admin123'
How to fix
Never hardcode passwords.
Read them from environment variables:
dbPassword := os.Getenv("DB_PASSWORD")Store them in configuration files excluded from git:
# .env (in .gitignore) DB_PASSWORD=secure_password_hereInject secrets at runtime through Kubernetes Secrets, Docker secrets, or CI/CD secret variables.
Configuration
Allow test passwords:
[validators.secrets]
allow_list = [
"password.*test",
"password.*example",
]
Disable the password pattern entirely:
[validators.secrets]
disabled_patterns = ["generic-password"]
Related
Hook output
When this error is triggered, klaudiush writes JSON to stdout:
permissionDecisionReason (shown to Claude):
[SEC002] Potential secrets detected: hardcoded password found in code. Remove hardcoded password and use secret management.
systemMessage (shown to user): Formatted error with fix hint and reference URL.
additionalContext (behavioral guidance):
Automated klaudiush validation check. Fix the reported errors and retry the same command.