Prompt Injection
Untrusted content that reaches a model's context and is treated as instruction.
Prompt injection is the attack in which text controlled by someone other than the operator reaches a model's Context Window and is acted on as instruction. In the indirect form the attacker never talks to the model at all — they plant text in a document, a web page, an issue description, or a dependency's release notes that the agent will later read.
It is structurally hard because models have no reliable boundary between instructions and data. Everything in the window is text. Filtering helps at the margins and cannot be relied on.
The defences that hold are architectural rather than linguistic:
Least privilege. Scope what the agent can do so that a successful injection has a small ceiling. An agent that only needs to post a comment should not hold a credential that can write to the repository. See Least Privilege.
Close the exfiltration channels. Credentials tend to be sitting in the working directory — a version-control config that persisted an access token, an environment file — where an unrestricted read plus any outbound request walks them out. Restrict outbound destinations to a known list, and be aware that a search query is attacker-composed text sent to a third party, which is the one channel a destination allowlist cannot close.
Confirm before acting outward. See Human in the Loop.
See also6
Hand-picked in the note itself — the neighbours worth reading next.
Guardrail
A rule constraining what a model may do, enforced by prompt, schema, or surrounding code.
Agents & Language Models13 connections
Secret Management
Storing, distributing, and rotating credentials without embedding them in code or history.
Systems & Tooling15 connections
Supply Chain Security
Protecting against compromise arriving through the code and tooling a project depends on.
Version Control & Delivery9 connections
Least Privilege
Granting only the permissions actually required, so a compromise has a small ceiling.
Systems & Tooling9 connections
Model Context Protocol
An open protocol for exposing tools, data, and prompts to AI applications through a uniform interface.
Agents & Language Models10 connections
Prompt
The text supplied to a language model to elicit a response.
Agents & Language Models12 connections
Related2
Nearby in the graph rather than deliberately chosen. Looser, sometimes surprising.
Linked from9
Notes elsewhere in the wiki that reach for this one.
- Code SigningSystems & Tooling
Cryptographically attesting who produced a binary, and the operating-system checks built on it.
- GuardrailAgents & Language Models
A rule constraining what a model may do, enforced by prompt, schema, or surrounding code.
- Human in the LoopAgents & Language Models
Requiring a person's judgement at chosen points in an otherwise automated process.
- Least PrivilegeSystems & Tooling
Granting only the permissions actually required, so a compromise has a small ceiling.
- Model Context ProtocolAgents & Language Models
An open protocol for exposing tools, data, and prompts to AI applications through a uniform interface.
- PromptAgents & Language Models
The text supplied to a language model to elicit a response.
- Secret ManagementSystems & Tooling
Storing, distributing, and rotating credentials without embedding them in code or history.
- Supply Chain SecurityVersion Control & Delivery
Protecting against compromise arriving through the code and tooling a project depends on.
- System PromptAgents & Language Models
The standing instructions that frame every turn of a conversation with a model.