Guide · November 24, 2026 · 10 min read
Prompt Injection Defenses for Internal Assistants
How untrusted documents, tickets, and web pages can steer an internal assistant, and the controls that keep instructions, tools, and data separate.
Internal assistants sit between employees and the organization’s documents. Someone asks a question; the assistant retrieves a policy, a ticket, a clause, or a web page and answers. That is also how untrusted text reaches a system that may see more than the user and, in some designs, may call tools. Prompt injection is the failure in which that text is treated as an instruction rather than as material to read. The defense is a set of boundaries: policy apart from content, reading apart from acting, and what the model may know apart from what it may do.
Teams running an assistant over tickets, knowledge bases, shared drives, or the web can use the controls below to keep instructions, tools, and data apart. The guide does not describe how to construct an attack. The job to aim for is narrow: answer from sources, stay inside policy, and refuse to let a document rewrite either.
Direct and indirect injection
Direct injection is a chat message that conflicts with policy: a request to reveal hidden configuration, to set a restriction aside, to call an unneeded tool, or to rank a later message above the system rules. The attempt is visible in the conversation. Acceptable-use rules and account controls still apply, and the assistant needs a technical refusal, because an ordinary employee and a compromised account look the same at the model boundary. User text does not outrank system policy.
Indirect injection is an instruction inside something the assistant was asked to read. A shared document, a pasted email, a ticket, a wiki page, a PDF, or a web page can address the model rather than the human reader. The employee who asked for a summary did not write that text and may never see it. This is the harder case, because retrieval is the product. Reading the page is the job. Obeying the page is the failure.
Direct input is untrusted intent. Retrieved text is untrusted data written as prose. Both can request an action. Neither may change policy, widen tools, or move secrets. A review that only tries the chat box, and never a document containing an instruction, has missed the system that will ship. Pasted clauses, logs, and excerpts are data too: the question is the task, and the paste is evidence.
Treat retrieved text as data, not instructions
A retrieval assistant builds a request from fixed policy, the question, and chunks from an index or a live fetch. Models follow specific, emphatic sentences, so a chunk that says what to do next can steer a weak boundary. Label each span in the application: origin, who could read it, and which index or URL produced it. The template should say the span is content to answer from, not a channel for new rules. That sentence is required, and it is not the control by itself. Templates change and models are swapped, so pair the label with checks the application enforces.
Document question-and-answer allows a short list of outcomes: answer from the sources, quote or cite them, say the sources are silent, or refuse an out-of-scope question. A source must not add a tool, change identity, switch tenant, or replace the task. A procedure the assistant should follow is a versioned runbook with an owner, not whichever page ranked first.
Keep the template’s markers out of the data. If headings, sentinels, or role labels delimit sections, escape those strings in titles, subjects, and filenames so a field cannot close one section and open another. Where the API allows it, put each document in its own message instead of one spliced string. Hold the boundary in code.
Citations belong in the control set. A claim about a document should point at a chunk; drop sentences no span supports. Block write-back into memory as well. Summaries, profiles, and “remember this” stores become instructions on later turns. If a document can save a standing rule, the effect outlives the request. Memory writes need an explicit user action and an allow-list. A ticket summary is data. A preference that changes later tool use is policy, and tickets do not set policy.
Separate system policy from user content
Policy is the small set of rules the organization owns: purpose, prohibitions, the tool list, and what happens when sources conflict with the question. The question, the history, the documents, and the web pages are content.
Put policy in a channel the application controls: a system or developer role, or a server-side preamble the client cannot replace. Keep it apart from documents, where the platform ranks it above user and tool content, and short enough that someone will reread a change. Version it. A prompt edit is a release. Store the template id on the request so a review can name the rules in force, with an owner, a diff, and a rollback.
Untrusted bytes must not impersonate that channel. Escape any rule marker inside user text and retrieved text. Prefer one policy message, one question, and a separate message per source, and test that document bytes never land in the policy message.
Write the conflict order once. Policy beats a document. Two documents that disagree are both cited, not settled by whichever is louder. A forbidden request is refused, with a pointer to the human process when one exists. Role and tenant come from the authenticated session. A page that names an administrator, a vendor, or the model provider is a sentence, not an access decision.
Limit the tools available during document question-and-answer
Tools are how a reader becomes an actor. Text can mislead a person. Mail, tickets, queries, and arbitrary fetches can turn a sentence in a file into an operation. Most document question-and-answer needs none of that.
Give the reading surface retrieval only. A different workflow, with its own policy and a person in the loop, can open a ticket or send a message when that is actually required. One agent wired to every internal tool is how a summarizer acquires a mailbox.
Search only collections the user may already open, and enforce that in the tool with the user and tenant passed in. A permission check that lives only in the prompt will not hold. Prefer an index chosen from a fixed list over a free query against an arbitrary system. A fetch tool, if you need one, allows named hosts, refuses private and link-local addresses, and returns text rather than credentials. A corpus you already hold does not need open browsing.
On a reading turn, leave acting tools off. A later turn can offer one tool after the person confirms the action and the arguments in the product UI. Asking the model if it is sure is not that confirmation. Tool results re-enter as data. A result does not become a system message and does not unlock the next tool.
Check outputs before a tool call
A model request to call a tool is a proposal. The application accepts or rejects it.
Check a schema first: known tool name, typed arguments, lengths, enumerations. Reject the rest. Do not pass model text into a shell, a query language, or a URL builder. Schema validation stops malformed calls. It still allows a well-formed call that is the wrong action.
Bind the call to the task with an allow-list from intent to tools and argument shapes. A document question does not send, delete, change permissions, or fetch a host that was neither in the question nor on the approved source list. If the mapping is ambiguous, ask the person. Positive rules survive longer than a list of banned phrases.
Arguments must come from data the application trusts: the session, a tool result it already recorded, or the user, chosen from those sets. An account, mailbox, or callback named inside a ticket is content. It is not permission to use that destination. That check is what stops a document from picking where an action goes.
Show the action. The rationale and the call should match, including recipient and payload for anything that leaves the system. Hide raw model channels that hold material the user should not see. Fail closed on validator errors, timeouts, and unknown tools, with a reason code and no quieter fallback.
Money, access changes, messages outside the tenant, and bulk reads need a person approving the exact call, arguments visible, with a real deny. A dialog that only asks whether the assistant may continue has not shown the action.
Keep secrets out of the prompt
Prompt text can leave in an answer, a log, a trace, or a support ticket. Assume a later passage, including one inside a document, may ask the model to repeat what it was shown. Withhold the secret.
API keys, passwords, tokens, connection strings, and private keys stay out of the system prompt, the user prompt, and any store the assistant reads. The application supplies tool credentials per call, outside the model context. The model sees the tool name and the business arguments, not the credential.
Other tenants’ data, sensitive hidden reasoning, and raw access lists do not belong in the prompt as a caution to the model. If the user’s role cannot open a document, do not retrieve it. Filtering after the model has seen the text is late. Obscure hostnames, unreleased paths, and incident write-ups deserve the same restraint. Hiding the policy text is a weak control; leaving out material that would do harm if quoted is a strong one.
Full-prompt traces store whatever you included. Sample, redact, and limit readers. A captured secret is an incident even if the answer was fine. Observability for AI systems covers sampling. Secrets never enter the span in the first place.
Log suspicious overrides
Record boundary events, not every document. For each one, keep a request id, the surface, the actor, and the time:
- A user message or a source asked the assistant to ignore, replace, or reveal policy.
- A tool call was rejected, with the reason code, or a call ran, with the tool name, a hash or redacted arguments, and the caller.
- Retrieval flagged a source, for example text that addressed the assistant as if it were policy.
- The assistant refused, with a category.
Store reason codes in the main log. Keep a short passage only in an access-controlled security store, with ordinary security-log retention. Raw document bodies do not belong in the application log; the passage may be trying to travel into a ticket or an analyst’s notes.
Alert on patterns: the same override language across many tickets, a spike in rejected calls, hits on one newly edited page, or one external address recurring in suggested arguments. One employee experimenting is a coaching case. The same wording across a corpus belongs to the corpus owner. Investigators get the records; prompt work gets the counts. Sample refusals monthly. An unread log is storage.
What a review should ask
These questions are enough to see whether the boundaries are real.
Sources. Who approved the read list? Is every source data? Can a document the user cannot open still reach the model? Who can pull a changed or flagged document the same day?
Channels. Where does policy live, who changes it, and is it versioned? Can user or retrieved text enter that channel? What is the written conflict order, and which test shows a document cannot appoint a rule?
Tools. Which tools are on this surface, and which change state or leave the tenant? What is the intent-to-tool allow-list? Where is authorization enforced? What happens on schema failure, and how do you disable one tool without a rushed release?
Secrets and outputs. What enters the prompt besides the user’s content? Where do credentials live, and what do traces keep? What must be true before a call runs? When does a person approve, and what do they see? Can a reading task write memory, send mail, or change a record?
Evidence and operations. Did the last test include a document, a ticket, and a web page that contained an instruction, against the production tool set? Is there a test that fails if someone later adds a tool to the reading surface? Who owns the assistant, who owns the corpus, and can a reviewer rebuild one request from template version, sources, and the tool decision?
Write the answers beside the system. A question with no answer means that tool or source stays off. Ship reading first. Add action when the checks have owners.
AI governance in practice covers tiers and audit trails, and evaluating LLM applications covers pre-release tests.
A boundary the application holds
A block list of phrases fails as soon as the wording changes. The control holds when untrusted text has no path into policy, tools, or secrets. Read widely and act narrowly. Documents inform an answer. They do not appoint rules, and they do not choose what the system may do. The model proposes. The application, the session, and the signed policy decide.
This is general information, not legal advice. It does not state your regulatory duties, your contracts, or a control set for one deployment. Counsel and your security team judge what applies to you.