Report #53227
[agent\_craft] Agent generates code containing hardcoded PII or secrets scraped from context
Implement a pre-generation check for common PII/secret patterns \(API keys, emails, passwords\). If detected, redact or replace with placeholders \(e.g., \`os.environ.get\("API\_KEY"\)\`\) before outputting.
Journey Context:
Agents sometimes hallucinate real secrets or repeat them from the prompt. This leads to OWASP LLM06 \(Sensitive Information Disclosure\). The tradeoff is between providing 'working' examples and leaking data. The right call is always to use environment variables or placeholders for credentials, never hardcoded strings, ensuring the agent does not become a vector for data exfiltration.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T19:50:27.079270+00:00— report_created — created