New Cheat Sheet: Secure Coding with AI#2132
Conversation
|
Thanks for putting this together, Raza. There's real work here and the do/don't structure is good. I want to flag some scope and framing concerns before this lands, because I think we'd be shipping a cheat sheet that's already out of step with where AI-assisted development actually is in 2026. On the framing. The doc is built around the idea that AI suggests code, the developer accepts it, and then you run your normal AppSec pipeline against the result. That's a 2023 mental model. The current reality is agentic coding. Tools like Claude Code, Cursor agent mode, Aider, Devin, Copilot Workspace, and Codex execute shell commands, install packages, edit files, run tests, hit the network, and push branches autonomously, often with auto-accept turned on. A cheat sheet titled "Secure Coding with AI" needs to address that threat model head on, and right now it largely doesn't. On overlap. Sections 3, 4, 5, 6, and 7 collapse to one sentence: AI-generated code is code, so run your existing pipeline against it. That's already covered by Software Supply Chain Security, Secrets Management, and the Secure Coding Practices Quick Reference. Sections 11 and 12 (auth and crypto) are generic AppSec advice with "AI-generated" prepended, and that ground is covered elsewhere too. Section 9 (DPIA, GDPR, IP, training opt-out) is procurement and governance, not secure coding, and probably belongs in a separate AI governance doc. On what's missing. None of the following appear in the PR, and they are the dominant risk classes in agentic dev tooling today:
On cross-references. The repo already ships `AI_Agent_Security_Cheat_Sheet.md`, `LLM_Prompt_Injection_Prevention_Cheat_Sheet.md`, and `Secure_AI_Model_Ops_Cheat_Sheet.md`, all of which cover material this PR touches (tool least-privilege, indirect injection, HITL, multi-agent). The new cheat sheet should cite and extend them rather than float beside them. Two paths forward I'd be comfortable with: (A) Rework in place. Keep the sections that are genuinely AI-coding-specific (section 1 on hallucinated deps, section 8 on context leakage, parts of section 13 on prompt-to-code supply chain). Drop the generic AppSec restatement. Add sections covering indirect prompt injection in coding agents, MCP and tool security, agent runtime sandboxing, rules-file integrity, out-of-scope edit review, and test fabrication. Lead with a trust boundary diagram. Cross-reference the three existing AI cheat sheets and align with AISVS. (B) Narrow the scope and split. Rename this one to something like "AI Coding Assistant DevSecOps Pipeline Cheat Sheet", strip sections 9, 11, 12, and 15, and keep it focused on what changes in your existing pipeline. Then open a companion cheat sheet, "Agentic Coding Security Cheat Sheet", for the threat-model-heavy material above. Either path works for me. Happy to help shape an outline for the agentic side if that's useful. As-is, I don't think we should merge it. It would tell readers the wrong thing about where the risk actually lives in 2026. Jim |
- Added trust boundary diagram - Added indirect prompt injection in dev loop - Added MCP and tool security - Added agent runtime sandboxing - Added rules-file integrity - Added out-of-scope edits and review anchoring - Added test fabrication and deletion - Added CI/CD confused deputy risk - Added markdown/unicode/bidi injection - Added multi-agent propagation - Removed generic AppSec restatement (covered elsewhere) - Removed governance section (not secure coding) - Cross-referenced AI Agent, MCP, and LLM Prompt Injection cheat sheets - Updated OWASP Top 10 mapping
|
Thanks Jim -- really appreciate the detailed feedback. Makes perfect sense. Bow to your experience on this one :) Went with option A and reworked the whole thing.
Cheers, |
|
@jmanico can you please review it again after changes? |
Addresses #2127.
Thanks @mackowski — second one from the batch.
All pretty standard and clear guidance — 16 sections covering the security risks specific to AI-assisted development, from hallucinated dependencies through to human accountability. Practical Do/Don't format with OWASP Top 10 2021 mapping.
Sections:
Plus OWASP Top 10 mapping (A01-A10) and references including CVE-2026-39313.
Cheers — Raza :)