# Prompt injection

Prompt injection is an attack in which text given to a language model, typed by a user or hidden in a document, web page or record it reads, changes the model's behaviour in ways nobody intended. It is first on OWASP's 2025 list of risks for LLM applications, and in a business app the defence that holds is that the model can never act alone: in Meadowstack, a change an assistant proposes does nothing until a person says yes.

Checked 2 December 2026. By Bohuslav Poláček. https://meadowstack.com/glossary/prompt-injection/

*The starter's MCP and AI settings page: what a server needs and the rules it keeps.*

From `templates/starter/src/workspace/settings-mcp.tsx` in the Meadowstack repository:

```ts
const needs = [
  "A server route that speaks MCP, deployed with the app's backend.",
  "Keys an admin makes here, each read only or read and write, shown once and revocable.",
  "Tools that call the app's api as the person who made the key, never with more rights.",
  "A log of every call: who asked, what for, and whether a person said yes.",
];

const rules = [
  "An assistant never gets more rights than the person who connected it.",
  "Every change it asks for waits for a person's yes in the app.",
  "Every call is written to the log.",
```

## Why it matters in a business app

OWASP distinguishes **direct** injection, where a user's own prompt changes the model's behaviour, from **indirect** injection, where the model reads outside content (a supplier's e-mail, an uploaded PDF, a comment on a record) that carries instructions. The second is the business app's problem: anyone who can write a comment can write to the assistant.

No filter catches every phrasing, so the damage has to be limited by design. OWASP's mitigations include least-privilege access for the model, human approval for high-risk actions, and keeping external content separate and marked.

## How Meadowstack handles it

What 2.1 ships is the interface and the rules; the model and its server are yours:

- **The assistant proposes, a person decides.** The kit's [AssistantPanel](https://meadowstack.com/components/assistant-panel/) shows a change as a proposal card with Yes and No; the recipe `docs/recipes/notifications-and-assistant.md` makes the yes a second request by the person, checked again with `can()`. The demo's assistant is a script, not a model.
- **The model acts as the person.** Reading tools return only what the person may see; writing tools store a proposal and do not write. An assistant never gets more rights than the person who connected it ([least privilege](https://meadowstack.com/glossary/least-privilege/)).
- **The browser never calls the model**, and the model's key is a server secret.
- **Every call is logged**, so an odd request can be traced.
- **Untrusted text stays text.** The kit's `Markdown` renders to elements, never to HTML, and does not load images, so a model's answer cannot smuggle markup into the page.

The same rules apply to the [MCP](https://meadowstack.com/glossary/model-context-protocol/) server your app would offer.

## Common mistakes

- **A write tool that writes.** The model's yes is not a person's yes.
- **A service account behind the model.** One injected instruction then reads every client's records.
- **Trusting a system prompt to hold.** It narrows behaviour; it does not enforce anything.
- **Rendering the model's output as HTML.** An injected link or image can carry data out of the page.

## A proposal, not an action

*The demo's assistant answers from the snag list and offers a change that waits for a person's yes.*

A live screen, rendered from the kit's components on the page: https://meadowstack.com/glossary/prompt-injection/

## Questions

### Can prompt injection be fully prevented?

No known filter stops every phrasing. Limit what a successful injection can do: the model acts with the person's rights, writes wait for a person's yes, and every call is logged.

### What is indirect prompt injection?

Instructions hidden in content the model reads, such as a web page, a file or a record, rather than typed by the user. In a business app any text field another person can fill is a possible source.

### Does Meadowstack include a language model?

No. 2.1 ships the assistant's interface, the proposal card and the rules; the demo's assistant is a script. You connect a model behind your own backend, following the recipe.

## Sources

- [OWASP Top 10 for LLM Applications 2025, LLM01: Prompt Injection](https://genai.owasp.org/llmrisk/llm01-prompt-injection/), checked 2 December 2026

## Related

- [Permissions checklist for apps built with AI](https://meadowstack.com/tools/permissions-checklist/) (Tools)
- [A secure vibe coding checklist for business apps](https://meadowstack.com/blog/secure-vibe-coding-checklist/) (Blog)
- [Roles and permissions UI patterns for business apps](https://meadowstack.com/blog/roles-and-permissions-ui-patterns/) (Blog)
- [Team and roles, with the rules in code](https://meadowstack.com/screens/roles-and-permissions/) (Screens)
- [Permissions](https://meadowstack.com/patterns/permissions/) (Patterns)
- [The approval flow](https://meadowstack.com/patterns/approval-flow/) (Patterns)
