AI & Local LLM • 2026-10-22 • 3 min read
Prompt Injection Is an Input-Handling Bug, Not a Model Problem
Filtering for "ignore previous instructions" is security theatre. What actually contains prompt injection is the same thing that contains SQL injection: never letting data reach a position where it is read as an instruction.

A model that reads a document and follows an instruction hidden in it is not malfunctioning. It is doing exactly what it was built to do: continue text. The vulnerability is in the system that put untrusted text and trusted instructions in the same channel and then acted on the result.
That reframing matters, because it tells you where the fix goes. Not in the prompt. In the architecture around it.
Why pattern matching fails
The first instinct is a block-list — "ignore previous instructions", "you are now", "disregard the above". We built one. It catches the examples in the blog post that inspired it and nothing else.
The payload can be in another language, base64, a homoglyph, split across lines, phrased as a polite request, or sitting in white-on-white text in a PDF. The space of ways to say "do this instead" is the space of language. You cannot enumerate it, and every rule you add also starts rejecting legitimate documents that happen to quote an email.
Keep a matcher if you like — ours uses aho-corasick and costs nothing — but treat it as telemetry, not as a control. It tells you someone is probing. It does not stop them.
What does work
Privilege separation
The model's output is a *suggestion*. Anything with consequences goes through code that re-checks authorisation against the user's own permissions, not against what the model asked for. If a summarisation assistant can emit "send this to accounts@…", the send path must verify that this user may send to that address — exactly as it would for a form submission.
Typed tools with narrow surfaces
A tool that takes {"ticket_id": "u32", "status": "open|closed"} can be misused to close a ticket. A tool that takes {"sql": "string"} can be misused to do anything. The blast radius of an injection is the union of your tool signatures, so design them the way you would design an API for a hostile client — because that is what you have.
Structural separation
Retrieved content goes in a clearly delimited region, with the system prompt stating that everything inside it is data to be analysed and never an instruction to follow. This is not reliable on its own — it is defence in depth, and it is free.
let prompt = format!(
"{system}\n\n<untrusted-document>\n{}\n</untrusted-document>\n\nTask: {task}",
sanitise_delimiters(&document),
);sanitise_delimiters strips any occurrence of the closing tag from the document. Without it, the document can close its own region and write outside it — the same bug as an unescaped quote in a SQL string, with the same fix.
Output constraints
Make the model return a typed structure, parse it, and reject anything that does not fit. A free-text response that your code then interprets is an interpreter you did not mean to write.
Human confirmation where it counts
For irreversible actions — sending, paying, deleting, publishing — show the user what will happen and get an explicit confirmation. This is the control that holds when every other one has failed, and it is the one most often dropped for convenience.
The honest summary
You cannot make a model immune to persuasion. You can make the system around it one where persuading the model does not accomplish anything, because the model never held the authority in the first place. That is the same discipline as masking data before it reaches the model: assume the component will be compromised and limit what that is worth.