Choosing what an AI model reads
An AI model answers from whatever it is handed with each request. That can be instructions, documents, search results, earlier messages and the output of tools.
Choosing and shaping that material has come to be called context engineering. When the material comes from an organisation's own files, inboxes and systems, security and data protection come into it too.
Text the model reads can steer it
In a blog post from December 2025, the National Cyber Security Centre (NCSC) explains why. "Under the hood of an LLM, there's no distinction made between 'data' or 'instructions'; there is only ever 'next token'."
So a document the model retrieves can carry instructions of its own. The NCSC's example is a CV with hidden text telling a screening system to approve it for interview. The NCSC notes this is commonly called indirect prompt injection.
The NCSC thinks it very possible that prompt injection attacks "may never be totally mitigated" in the way SQL injection can be. It suggests aiming to reduce the likelihood or the impact of an attack.
What the model is allowed to do
The NCSC says prompt injection becomes particularly critical when a system calls tools or APIs based on the model's output, because an attacker can then push the model into using them. It advises design protections built on deterministic safeguards, outside the model, that limit what the system can do.
It gives a rule of thumb: "don't let an LLM processing emails from random external people have access to privileged tools".
The UK government's Code of Practice for the Cyber Security of AI makes a similar point. Where an AI system works with other systems or data sources, the permissions it holds there should be only what it needs to function, and risk assessed.
The NCSC also advises caution with any product that claims it can 'stop' prompt injection. It suggests looking instead for products that explain how they reduce the risk.
Personal data in the context
Where documents or emails contain personal data, what the model is given falls under UK data protection law.
The Information Commission, the regulator that took over the ICO's functions on 30 September 2026, describes the data minimisation principle. You identify the minimum personal data you need for your purpose, and you process that and no more.
The Information Commission also asks technical teams to record and document every movement and store of personal data, so the right security controls can be applied.
Its AI guidance carries a note that it is under review, as the Data (Use and Access) Act has brought in changes.
Keeping a record
The Code of Practice asks developers to keep an audit log of changes to system prompts and other model configuration.
It asks those who run a system to keep logs of what the system and its users do, to help investigate incidents.
The NCSC suggests logging enough to spot suspicious activity. That may include the model's full input and output, and the tools and APIs it calls.
The wider guidance
The NCSC's Guidelines for secure AI system development follow the whole life of a system, with security at each stage. They start at design and development, then go on to deployment, and then to operation and maintenance.
The Code of Practice sets out 13 principles. It came out on 31 January 2025. For public sector teams, the Government Digital Service publishes the AI Playbook for the UK Government.
Useful links
- Prompt injection is not SQL injection (it may be worse) (NCSC)
- Guidelines for secure AI system development (NCSC)
- AI Cyber Security Code of Practice (GOV.UK)
- How should we assess security and data minimisation in AI? (Information Commission)
- Guidance on AI and data protection (Information Commission)
- AI Playbook for the UK Government (GOV.UK)