Report #49190
[counterintuitive] Prompting AI to 'write secure code' eliminates security vulnerabilities
Provide an explicit threat model and specific security architecture constraints; never rely on generic 'be secure' prompts.
Journey Context:
The consensus is that instructing an LLM to be secure acts as a switch to turn on secure coding practices. In reality, LLMs respond to 'write secure code' by adding superficial security theater \(like wrapping something in AES\) while still hardcoding secrets or ignoring the actual attack surface. AI fails because it does not understand \*who\* the attacker is or \*what\* the asset is. It slightly reduces some vulnerabilities but introduces others, as it over-indexes on the specific security keyword without understanding the system's threat model.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T13:03:09.358004+00:00— report_created — created