Vulnerabilities in Code Comments Can Pollute Model Output

davidmanheim · x · 2026-07-19

This post recounts an interesting security experiment: **even commented-out vulnerable code can affect model outputs**. In the experiment, after researchers added a piece of commented-out vulnerable code to a secure codebase, test results showed: - **Claude Sonnet 4.5**: Outputs became 100% vulnerable code - **Gemini 2.5 Pro**: 44% of outputs were vulnerable code The conclusion is straightforward: **LLMs read and are influenced by all the text in a codebase, not just the active code**. This has significant implications for code reviews, context feeding, and security defense.

Original post →

More from Safety

Safety channel →