AI Agent Security: Prompt Injection Is an Authorization Problem Too

Prompt injection becomes dangerous when untrusted content can reach powerful tools. This deep analysis reframes agent defense around authorization, data flow, and complete mediation.

A human-held approval token controls the gate between an agent planner and a protected downstream tool.

Prompt injection is often described as an input-filtering problem: find the malicious instruction and remove it before the model sees it. That framing is incomplete for an AI agent. Once a model can search files, read email, call APIs, edit records, send messages, or spend money, the decisive question is not only what text influenced the model. It is why the surrounding system allowed that influence to become an authorized action.

A secure agent must assume that some hostile or misleading content will reach the model. OpenAI describes modern prompt injection as increasingly similar to social engineering, and OWASP treats both prompt injection and excessive agency as major risks. The engineering objective is therefore not perfect detection. It is to constrain impact when detection, model judgment, or user attention fails.

The model is a planner, not an authorization authority

A language model can propose an action. It cannot establish that the action is allowed merely by saying that it is. Authorization must come from deterministic policy, the authenticated user’s current authority, the application’s purpose, and the context of the specific request.

For every proposed tool call, the system should be able to answer:

  • Who is the authenticated actor on whose behalf the agent is operating?
  • What action is requested, including whether it reads, creates, changes, transmits, or deletes?
  • Which resource and tenant does the action affect?
  • Why is the action necessary for the user’s stated task?
  • Under which constraints—amount, destination, record count, time window, data class, or approval state—may it proceed?

If the answer exists only in the prompt, it is not an enforceable authorization rule. Prompts influence model behavior; they do not replace access control.

Prompt injection crosses the instruction and data planes

Traditional software usually treats code or commands differently from data. Agentic systems place natural-language instructions and retrieved data in the same model context. A webpage, email, document, calendar invitation, support ticket, image, or tool result can contain words that resemble instructions. The model must infer which text is authoritative.

A direct injection comes from the user input itself. An indirect injection is embedded in content the agent retrieves while doing legitimate work. The second case is especially important because the user may never see the hostile text. The document is authorized to be read, but it is not therefore authorized to redefine the task.

Fine-tuning, retrieval-augmented generation, a longer system prompt, or a list of forbidden phrases does not restore a hard data/instruction boundary. Those techniques may improve resistance, but the surrounding application still needs to enforce what data can flow into which action.

Analyze sources and sinks

A practical threat model identifies untrusted sources and consequential sinks.

Sources include user-supplied text, public webpages, messages from external senders, uploaded files, shared drives, search results, retrieved database rows, tool responses, model memory, and output from peer agents. Even content from a familiar domain can be user-generated or compromised.

Sinks include sending data to a new recipient, opening a URL that contains sensitive parameters, changing permissions, creating a payment, issuing a refund, deleting a record, executing code, updating a customer profile, publishing content, or retrieving a more sensitive dataset.

The dangerous path is not simply “malicious text reached the model.” It is “untrusted content influenced a high-impact sink under credentials that made the action possible.” Controls can break that path at several points:

  1. label and isolate untrusted content;
  2. limit the model’s available tools and arguments;
  3. authorize each call in the user’s context;
  4. validate data flow and destinations;
  5. require a specific approval for consequential actions; and
  6. constrain, monitor, and reverse the effect where possible.

Separate capability from permission

An agent may know how to call a tool without being permitted to use every function that tool exposes. Do not hand a model one broad “email” tool if the intended task requires only reading. Expose narrow capabilities such as list_message_headers, read_selected_message, and draft_reply. Keep send_message, mailbox search across all folders, forwarding, and deletion separate.

Then back those boundaries with real downstream permissions. A read-only tool should authenticate with a read-only scope. A database query tool intended for reporting should not connect as an account that can update or delete. If a shared service identity has access to every tenant, an application-level tenant ID in the prompt is a warning label, not isolation.

OWASP’s excessive-agency guidance identifies three distinct problems: too much functionality, too much permission, and too much autonomy. Reducing only one leaves the others available. A tool gateway should minimize all three.

Execute in the user’s context

When an agent acts for a user, carry the authenticated user and tenant context to the downstream system. The tool layer should receive a verifiable identity or narrowly scoped delegation, not a free-form claim generated by the model.

A useful authorization envelope contains:

  • the authenticated subject and tenant;
  • the allowed action and resource class;
  • the specific task or workflow identifier;
  • scope limits such as recipient, amount, record count, or data classification;
  • an expiration time;
  • whether a fresh approval is required; and
  • an audit identifier that links the request, policy decision, and tool result.

The model may populate a proposed resource or argument, but a policy enforcement point validates it against the envelope. A model cannot expand the envelope by emitting convincing text.

Use complete mediation at the tool boundary

Every consequential call must be checked every time. Do not authorize the first call in a multi-step plan and assume later calls remain within scope. Retrieved content, tool errors, redirects, memory, or another agent can change the plan between steps.

The tool broker should perform deterministic checks before execution:

  • validate the function name against an allowlist for this workflow;
  • parse arguments with a strict schema and reject unknown fields;
  • bind tenant and user identifiers from authenticated context rather than model output;
  • look up the resource and enforce ownership or role-based policy;
  • validate destinations, data classifications, rate limits, and transaction limits;
  • check whether the operation is read-only, reversible, or high impact;
  • require a valid, action-specific approval where policy demands it; and
  • record the decision without logging sensitive payloads.

Output validation is therefore part of authorization. A syntactically valid JSON tool call can still be unauthorized. Schema validation proves shape, not intent, ownership, or policy.

Preserve data boundaries

An agent that can read confidential data and communicate externally creates an exfiltration path even if each ability seems reasonable alone. Review permissions as combinations, not isolated checkboxes.

Useful controls include:

  • separate agents or execution contexts for public research and confidential work;
  • keep external browsing logged out when authentication is unnecessary;
  • block sensitive fields from tool responses unless the task explicitly needs them;
  • restrict outbound domains and recipients for workflows that handle private data;
  • inspect redirects and final destinations, not only the first URL;
  • prevent secrets from appearing in URLs, model-visible logs, or error messages; and
  • use sandboxes for code or file operations with narrow mounts, network access, and lifetimes.

A simple trust label—trusted instruction, user data, internal reference, external untrusted content—can help the orchestration layer decide which sources may influence which sinks. The model should see provenance, but policy should not depend on the model honoring the label perfectly.

Design approvals as authorization events

“Human in the loop” is meaningful only when the human sees enough information to make a decision. A generic “allow tool?” dialog after many harmless prompts encourages reflexive approval.

A useful approval is:

  • specific about the action, target, and important arguments;
  • timely, appearing immediately before execution rather than at session start;
  • informed, showing what data will leave, what will change, and whether the action is reversible;
  • bounded to one action or a narrow, time-limited batch;
  • independent of the untrusted content that requested the action; and
  • auditable, linking the approver, displayed preview, and executed parameters.

For example, “Send the drafted response to pat@example.invalid and include the attached quarterly summary?” is reviewable. “Allow the agent to use email for this task?” is too broad. Use reserved example domains and synthetic data in tests; never place a real recipient or credential in a test prompt.

Some actions should remain prohibited even with a model-generated request and an approval click. Define non-delegable operations, separation-of-duties rules, and amounts or data classes that require a different channel or second approver.

Memory, retrieval, and multi-agent systems extend the boundary

Agent memory can turn one malicious document into a persistent influence. Store facts and preferences through a controlled schema rather than copying arbitrary model text into long-term memory. Record source, tenant, time, confidence, and expiration. Require stronger validation before memory can alter permissions, destinations, or standing instructions.

Retrieval systems need ingestion controls, document-level authorization, provenance, and deletion behavior. Retrieval relevance does not establish trust. A document may be highly relevant to the query and still contain instructions that should never control tools.

In multi-agent designs, treat peer output as untrusted unless there is an authenticated protocol and constrained contract. An agent’s statement that it “verified authorization” is not evidence. Pass signed or server-verifiable authorization context separately from natural-language messages, and re-check it at the final tool boundary.

A safe reference pattern

Consider a support assistant that summarizes new tickets and drafts replies. Its purpose does not require autonomous sending or account changes.

  1. The ticket connector retrieves only tickets assigned to the authenticated support user.
  2. Ticket text is marked as external, untrusted content.
  3. The model can classify, summarize, and call a read-only knowledge search scoped to approved support material.
  4. The drafting tool accepts a ticket ID from the orchestrator, not an arbitrary tenant or customer ID from the model.
  5. The draft is checked for restricted data and unsupported commitments.
  6. A human reviews the exact recipient, body, and attachments in the support system.
  7. The support system—not the model—authorizes and records the send under the user’s account.

If a ticket says to ignore policy, search other customers, or send records elsewhere, the model may still be influenced. The surrounding architecture prevents those instructions from creating the needed capability, permission, or approval.

Testing must cross the whole path

A classifier accuracy score is not an agent security evaluation. Test end-to-end paths from source to sink:

  • direct and indirect injections in each supported content type;
  • encoded, multilingual, visually hidden, or socially persuasive instructions;
  • requests that mix a valid task with an unauthorized extra action;
  • cross-tenant resource identifiers and stale authorization;
  • redirects, tool errors, retries, and partial failures;
  • poisoned memory or retrieved content;
  • approval fatigue and mismatch between previewed and executed parameters; and
  • attempts to move sensitive data from a readable source to an external sink.

Measure more than attack refusal. Track unauthorized tool attempts blocked by policy, sensitive fields withheld, approvals requested and denied, destination changes, cross-tenant denials, high-impact actions, and mismatches between user intent and tool execution. Red-team after model, tool, permission, retrieval, and prompt changes—not only before launch.

Defense in depth, with clear ownership

Model training, prompt hierarchy, input screening, output filtering, monitoring, and red-teaming all matter. OpenAI’s published guidance emphasizes layered defenses and constraining impact even when manipulation succeeds. None of those layers should carry the full authorization burden.

A strong design assigns owners for:

  • identity, tenant isolation, and downstream access policy;
  • tool contracts, schemas, scopes, and sandboxes;
  • data classification, retention, and outbound controls;
  • approval policy and user experience;
  • model, prompt, and retrieval evaluation;
  • audit logs, anomaly detection, and incident response; and
  • revocation, rollback, and customer communication.

NIST’s Generative AI Profile and AI-specific Secure Software Development Framework profile place these risks within broader governance and lifecycle work. That is the right scale: agent security is a system property, not a prompt-writing exercise.

Questions for an architecture review

  1. Which content sources can an attacker influence?
  2. Which tools can read sensitive data or create external effects?
  3. Which dangerous source-to-sink combinations exist?
  4. Are tools narrower than the underlying service account?
  5. Does every call execute in the authenticated user and tenant context?
  6. Can deterministic policy reject a call even when the model insists it is authorized?
  7. Are approvals specific, fresh, and bound to exact execution parameters?
  8. Can untrusted text enter memory or become a standing instruction?
  9. Can the team reconstruct who requested, approved, and executed an action?
  10. How quickly can credentials, tools, connectors, or a workflow be disabled?

Teams moving from prototype to implementation can connect this review to AI Solutions and Implementation and Cloud Security and Governance. Use-case, risk, and evaluation planning belong earlier in AI Advisory and Consulting.

Prompt injection may begin as adversarial text, but impact is determined by architecture. Treat the model as a fallible planner, keep authority in verifiable systems, and make every consequential action pass through a narrow, contextual, auditable decision point. To review an agent’s data and authorization boundaries, contact Bluegrass Cloud.

Sources

  1. OWASP GenAI Security Project: LLM01:2025 Prompt Injection
  2. OWASP GenAI Security Project: LLM06:2025 Excessive Agency
  3. OpenAI: Designing AI agents to resist prompt injection
  4. NIST AI 600-1: Generative Artificial Intelligence Profile
  5. NIST SP 800-218A: Secure Software Development Practices for Generative AI