Prompt injection occurs when untrusted content attempts to redirect an AI system's behaviour, for example through instructions inside a document it reads. Defence requires more than a warning prompt: restrict access, separate instructions from data and validate consequential operations.
Recognise the boundary
A webpage, email or document may try to redirect the assistant, override its task or trigger unrelated actions. That is the central prompt-injection problem: data being treated as an instruction source it was never authorised to become.
Limit the consequences
Separate trusted instructions from retrieved material. Restrict tools to the permissions needed for the task and validate proposed actions in application code. An assistant summarising a document should not acquire permission to send messages because the document asks it to.
Test the complete workflow
Use harmless examples containing obvious conflicting instructions and inspect both the response and tool calls. For a research assistant, a test page might ask it to abandon summarisation and invent a conclusion. Check that the authorised task continues and that unsupported content is not presented as evidence. Defence requires several layers, including access control and careful tool design. One warning sentence in a prompt cannot guarantee correct handling of every adversarial document.
A worked example
A research assistant opens a page containing text that tells it to ignore its task and disclose private information. The page is evidence to inspect, not authority to change the assistant's rules. Test such cases with harmless dummy data, limited permissions and an observable record of tool use. The application should prevent unauthorised operations even if the model is influenced by the text.
Questions readers ask
Can a system prompt completely prevent prompt injection?
No single prompt should be treated as a complete defence. Use software boundaries, limited permissions, validation and testing of the connected workflow.
Follow the evidence.
AI-assisted explanation with linked technical references. Examples are illustrative learning exercises, not reported customer deployments or experimental results.
Public sources support the factual background. Analysis and illustrative exercises are identified in the text. How we assess AI · Editorial standards
Spot a factual error or an outdated detail?



