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 3 of 6

The tells and their fixes

builds on: Trust boundaries and untrusted input
**Tell:** an untrusted value pasted into text that a database, shell or browser will parse. Look for: - SQL built with f-strings, `+`, `%`, `.format`, template literals, `fmt.Sprintf` or `String.format` - `shell=True`, `os.system`, Node `exec`, or `sh -c` with a value inside - `innerHTML`, `dangerouslySetInnerHTML`, `v-html` or `|safe`. For example, `innerHTML` turns a name like `<img src=x onerror=alert(1)>` into a live element whose `onerror` script runs. **Fix:** pass the value as data, using placeholders, argument arrays, `textContent` or auto-escaping templates. Table and column names can't be placeholders, so check them against an allowlist.
Terms on this card
template literals
JavaScript/TypeScript strings in backticks where ${expr} inserts a value. This is plain text insertion with no escaping.
placeholders
Markers like ?, $1 or %s in SQL text. The driver passes the real values separately, or escapes them correctly itself, so they are never parsed as SQL.
`.format`
Python string method that inserts values into {} slots in the text. It is plain text insertion with no escaping.
`fmt.Sprintf`
Go function that builds a string by inserting values into %s, %d and similar slots. It is plain text insertion with no escaping.
`String.format`
Java method that builds a string by inserting values into %s, %d and similar slots. It is plain text insertion with no escaping.
Learn this step by step on Bytewise
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