Report #40047
[agent\_craft] Agent includes hardcoded secrets, API keys, or credentials in generated code or logs them during execution
Never generate hardcoded credentials. Always use environment variable placeholders \(e.g., os.environ.get\('API\_KEY'\)\). If a user provides a secret in their prompt, do not echo it back in subsequent code or explanations. Refuse to write logic that exfiltrates secrets \(e.g., sending credentials to an external webhook\).
Journey Context:
Hardcoding secrets is a critical vulnerability \(OWASP LLM Top 10 LLM06: Sensitive Information Disclosure\). Agents often copy user-provided keys directly into code for convenience. The correct pattern is enforcing secure configuration management. Generating code that exfiltrates secrets violates fundamental security boundaries and provider policies against facilitating unauthorized access.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T21:41:33.041067+00:00— report_created — created