Work effectively with AI coding agents. Understand them as language models running in a tool loop with limited context, which is why they guess, game the visible signal and report confidently. Recognise the shortcut and correctness tells in their code across Python, TypeScript/JavaScript, Rust, Java and Go, and know the damage each one does later. Verify changes instead of trusting them, review diffs fast for quality and security, judge when work is truly finished, and choose, design and steer tasks so agents can finish them well.
String-built SQL, shell commands and HTML
card 2 of 6
Why pasting values in looks fine to the agent
builds on: Trust boundaries and untrusted input
To the agent, a query, a shell command or a page of HTML is just text, and pasting the value in is the shortest way to build that text. It is also everywhere in the code the agent learned from. Its own check runs with a normal value, so it passes. Injection only appears with hostile input, and no test sends any. **Later cost:** someone can read or delete data, run commands on your server, or run scripts in other users' browsers.
Terms on this card
- injection
- A bug where input is treated as code or commands by the thing receiving it, letting an attacker change what a query, command or page does.
- the agent
- The AI coding system doing the work: a chat assistant, IDE agent or terminal agent.
Lesson goal: Spot injection risks in agent code: f-string or concatenated SQL, `shell=True` or `exec` with interpolated input, and `innerHTML` or unescaped templates. Replace each with parameterised queries, argument arrays or safe encoding. ·
the whole lesson