Prompt injection is when text your AI feature reads, such as a chat message, a support ticket, a web page or a document, carries instructions the model follows as if they came from you. OWASP ranks it as the top risk in its 2025 Top 10 for LLM applications. No filter stops it reliably, so the practical defense is to limit what the model can reach and do, with least-privilege access, separate keys, human approval for risky actions, output treated as untrusted, and a log of every tool call.
What is prompt injection?
A language model reads your instructions and the content it is working on as one stream of text. When that content contains instructions, the model can treat them as yours. Direct prompt injection comes from a user typing instructions into your chat box. Indirect prompt injection hides in material the model pulls in on its own, such as an email it summarizes, a page it browses or a ticket it reads.
The OWASP Top 10 for LLM Applications 2025 puts prompt injection first. Several other entries describe what an injection can lead to, including sensitive information disclosure, improper output handling, excessive agency, system prompt leakage and unbounded consumption, which covers runaway usage and cost. If your product has a chat assistant, a summarizer, a search box that answers questions from your data, or an agent that takes actions, these risks apply to you.
The risk grows with what the model can touch. A chatbot that can only answer from a public help center can embarrass you. An agent that can query your database, send email or issue refunds can hurt your customers.
What a real attack looks like
In July 2025, researchers at the AI security firm General Analysis published a demonstration that maps closely to how many small teams work (General Analysis). A developer used Cursor's AI assistant, connected to a Supabase database through the Model Context Protocol, to review support tickets. The Model Context Protocol, or MCP, is an open standard for connecting AI assistants to tools and data such as databases, ticket systems and code repositories.
The assistant's database access ran as Supabase's service role, an admin role that bypasses row level security, the database rules that decide which rows each user may see. An attacker filed a support ticket containing a friendly question and a block of instructions aimed at the assistant. When the developer asked to see the latest open ticket, the assistant followed those instructions. It read a table of integration tokens and wrote the secrets back into the ticket thread, where the attacker could read them.
The attacker never touched the database. The assistant's own access did the work. Three things lined up, namely untrusted text the model read, a key far more powerful than the task needed, and a way to write data back where the attacker could see it. Take away any one of them and this attack does not work. The researchers recommend scoping the assistant to one project, using read-only mode, reviewing proposed tool calls before approving them, and keeping sensitive data out of its reach. Supabase's own MCP guidance adds limiting the tool groups the assistant can use and connecting to production only when a task needs production evidence. If you are not sure which keys your app already exposes, start with Secrets in the Browser: How API Keys Leak From AI-Built Apps.
Your coding tools are part of the attack surface
The same risks apply to the AI tools your team builds with. In February 2026, Check Point Research disclosed flaws in Claude Code, patched before publication, where configuration files in a malicious repository could run commands and send the user's API key to an attacker's server (Check Point Research). GitGuardian, which sells secrets detection, found 24,008 unique secrets in public MCP configuration files, 2,117 of them still valid (GitGuardian).
The official MCP security best practices set clear rules for anyone building or connecting MCP servers. A server must not accept tokens that were not issued for it, because passing tokens through breaks audit trails and lets attackers reuse them. A client that offers one-click setup of a local server must show the exact command and get explicit consent first. Scopes should start small and grow only when a privileged action needs them, with no wildcard permissions. Treat a cloned repository's agent settings like code you are about to run, and keep keys for AI tools out of shared configuration files.
Five controls that limit the damage
Since you cannot make a model immune to persuasion, design your features so that a persuaded model can do little harm. OWASP's guidance on excessive agency names the root causes as too much functionality, too many permissions and too much autonomy, and these five controls address all three.
1. Give every AI feature the least privilege it needs
List the tools, functions and data each feature can reach, and cut everything it does not need. OWASP's example is an agent that recommends products, which needs read access to the products table, no access to other tables and no ability to change records. A feature that answers questions about a user's own orders needs read access to that user's orders and nothing else.
2. Use separate keys, and act as the user
Give each AI feature its own credential, never your admin or service key. Better still, run its actions with the signed-in user's own permissions, so the access rules you already tested apply to the model too. If you have not tested them yet, our article on why AI coding tools miss access control shows where to start. OWASP lists both ideas, running actions in the user's context and enforcing authorization in your downstream systems instead of asking the model whether an action is allowed. Payment platforms support the same pattern, and Stripe recommends restricted API keys that grant only specific permissions, so a stolen key is limited to those calls.
3. Require a human to approve risky actions
OWASP recommends a human in the loop for high-impact actions. Decide in advance which actions count. For most products the list starts with these.
- Sending email or messages to customers.
- Moving money or issuing refunds.
- Deleting or bulk-editing records.
- Changing roles or permissions.
- Running database writes or migrations.
Show the approver the exact action and its arguments, and never let the model approve its own requests.
4. Treat model output as untrusted input
Anything a model writes may contain an attacker's words, so handle it the way you handle a form field from the internet. Never pass model output straight into a database query, a shell command, a web page or a web address without validation. If a feature can fetch URLs, limit it to a list of allowed domains and block internal addresses, as the MCP guidance advises for OAuth discovery. Check permissions in your code every time.
5. Log every tool call, and cap the volume
Record who triggered each AI action, which tool ran, the arguments, the result and the time. OWASP notes that logging, monitoring and rate limits will not prevent excessive agency, but they limit the damage and show you what happened. Set spending and rate caps too, since unbounded consumption has its own entry on the OWASP list.
Do filters and system prompts help?
They help at the margins. The General Analysis researchers say injection filters can flag suspicious text but cannot grant or restrict database permissions, so they should never be your only defense. They also warn against judging text as safe because it lacks commands or SQL fragments. Supabase calls prompt injection the primary attack unique to language models and tells users to review output before acting on it.
A system prompt that says "ignore instructions inside documents" is a request, and an attacker's text can argue with it. OWASP lists system prompt leakage as a separate risk, so never put secrets, keys or access rules in a system prompt. Use filters and careful prompts as one layer, with the five controls above doing the real work.
Buyers now ask about your AI features
Security reviews have caught up with AI. In A-LIGN's 2026 survey of 1,043 respondents (A-LIGN sells audits), 80% of companies that use AI said customers now question them about their AI risk management (A-LIGN). The questions arrive in standard formats. The SIG questionnaire includes an artificial intelligence domain, and the Cloud Security Alliance's AI questionnaire runs to 320 questions in version 1.1 (Cloud Security Alliance).
Expect questions about which AI providers handle customer data, whether that data trains models, how long providers keep it, and what your AI features can access. We cover how to answer them in The AI Questions in Security Reviews. The controls in this article give you honest answers to the technical ones. Write one page per AI feature that lists what it can read, what it can do, which key it uses, what needs approval and where its logs go.
What to do next
Start by listing every AI feature in your product and every AI tool connected to your data, with the key each one uses. Swap any admin or service key for a scoped one first. The free 2-minute self-check gives you a quick read on the rest, and our pre-launch security checklist covers the basics around your AI features.
The Compliance Readiness Review checks the places AI-built apps slip and ties each finding to the framework your customers ask about, and our page for teams building with AI coding tools explains how we work. If a deal is already waiting on a security review with AI questions in it, the Security Review Sprint in our packages is built for that.