AI Agent Permissions 🔐: Least Privilege Now (2026)12 min read2,362 words

AI Agent Permissions 🔐: Least Privilege Now (2026)

Learn AI agent permissions in 2026: secure indirect prompt injection defense, least privilege for AI, scoped approvals, and tool authorization tests—start now.

AI agent permissionsindirect prompt injectionAI agent securityleast privilege for AIAI tool authorization
AI Agent Permissions 🔐: Least Privilege Now (2026)

Who Gets to Give an AI Agent Instructions? A Practical Permission Model

You ask a coding agent to review a pull request, explain a failing test, and summarize what needs fixing. To do that well, it reads the diff, follows a link to the issue, and may check a runbook. The issue often has a checklist that says to close the ticket. Should the agent do it?

This isn't only a prompt-writing question. That checklist might be legitimate project context. But the user asked for a review, not a ticket update. If the agent can change issue status, your application has to decide whether that action is part of the task - or just something the agent happens to notice.

You hit the same boundary when agents read email, web pages, shared documents, and tool output.

This article lays out a practical way to separate useful information from permission to act. You'll see how to keep the source of instructions clear, scope tool permissions to the job, handle approvals safely, and test that the workflow behaves as intended. The goal isn't to stop agents from using context. It's to stop context from quietly expanding what they're allowed to do.

Why can a document influence an AI agent's actions?

An agent is useful because it can follow a chain of information. A code change points to an issue. The issue references a runbook. The runbook describes a test. Each source can help the agent understand what's going on.

Each source can also contain text that looks like an instruction.

That's the setup for indirect prompt injection: the agent is asked to inspect content, and the content - malicious, accidental, or just written for humans - tries to steer the agent's behavior. A checklist like "close when complete" isn't automatically an attack. The problem is that the agent may treat it as something to do in the current task, even if the user only asked for a review.

The risk depends on what the agent can do

The same interpretation can lead to very different outcomes, depending on your permissions. A read-only review agent might mention the checklist in its summary. An agent with access to issue management might close the ticket, changing a record that other people use to coordinate work.

This is why prompt injection is mostly an application design issue - not just a model behavior issue. You can't count on the model to reliably separate "a thing I'm reading" from "a thing I'm supposed to do." And you shouldn't rely on the system prompt as your only safety net. Your application should limit the damage if the model makes the wrong call.

UK National Cyber Security Centre analysis of prompt injection highlights the trouble of assuming untrusted content is harmless just because it's part of a legitimate task. Microsoft Research's Spotlighting work looks at ways to preserve provenance, so external text is easier to distinguish from trusted instructions. Those ideas can help. But they don't replace enforcing permissions at the point where an action happens.

Treat the action, not just the text, as the security boundary

A useful review can read an issue without being allowed to close it. It can draft a comment without being allowed to post it. Those are separate capabilities, and you shouldn't bundle them just because they happen in the same tool integration.

The practical question isn't only, "Can this text influence the model?" It's also, "If the agent follows that text, what could it change?" Figure out the consequences first, then decide which capabilities the task actually needs.

How should you separate context from authority?

A workable permission model separates three things: task instructions, reference material, and authorized actions. They can all exist in the same agent session, but they shouldn't carry the same weight.

Task instructions tell the agent what the user or application expects it to accomplish. Reference material helps it do that work: source code, an issue, a web page, a log, or a tool response. Authorized actions are what the agent may change or send. A document can be useful evidence without becoming permission to act.

Keep source and purpose attached to retrieved content

When an agent retrieves text, it should keep where that text came from and what role it plays. An approved contribution guide might be trusted for formatting rules. A pull request description might explain the proposed change, but it shouldn't grant permission to modify some unrelated ticket. An email can give context for a reply without authorizing the agent to forward confidential attachments.

That means avoiding a design that flattens every retrieved sentence into one undifferentiated block of "instruction-like" context. Preserve metadata such as source type, location, and whether the source is approved to shape workflow. If your agent interface supports it, make these distinctions explicit in the context you pass to the model.

This isn't a claim that provenance alone makes prompt injection disappear. Provenance helps the model reason about conflicts and helps the application make better decisions. The real boundary still belongs in the tool layer.

Define the job in terms of outcomes and limits

Before giving an agent tools, write the task as an outcome and a boundary. For example:

  • Outcome: review the pull request and identify defects or missing tests.
  • Allowed reads: pull request diff, relevant repository files, linked issue, and approved team guidance.
  • Allowed writes: none during analysis; optionally, one review comment on the specified pull request after approval.
  • Out of scope: merging the pull request, changing issue status, editing repository settings, or contacting other people.

This is usually more actionable than something like "help with this pull request." It gives engineering teams something concrete to encode and test. It also surfaces product decisions early: should the agent post comments automatically or only draft them? What counts as approval? Which record is the target?

The model might suggest an action based on something it read. A suggestion isn't authorization. Keeping those separate makes it easier for the agent to use context without letting every piece of context expand the job.

How do you enforce permissions in agent tools?

Permission checks have to run where the action happens. If an agent can call a tool that changes ticket status, then a prompt saying "do not close tickets" is not a real control. The service that handles the tool call should verify whether the operation is allowed for the current session and whether the target matches the task.

This is the difference between telling an agent what to do and controlling what it can do. A reliable design uses both: model instructions guide behavior, and tool authorization limits the actions available if the model misreads the context.

Start with the smallest useful capability set

For a review workflow, read access to the diff and relevant files may be enough to produce useful findings. If the product needs the agent to publish results, add a narrowly scoped write capability rather than granting broad repository access.

For instance, you might allow a comment on one specified pull request - but not arbitrary comments, merges, or issue updates.

A practical capability matrix might look like this:

Workflow step Example capability Default boundary
Inspect code Read diff and selected files Limit to the relevant repository and pull request
Gather context Read linked issue or approved guidance Do not treat retrieved text as permission to act
Prepare feedback Draft a review comment No external change yet
Publish feedback Post the approved comment Check the exact pull request and session policy
Change status Close or reopen an issue Exclude unless the task explicitly requires it

The principle here is least privilege, applied to the task rather than to a person's general account. A human might be allowed to close issues. That doesn't mean every agent session running under that identity should automatically inherit that capability.

Make approval specific and enforceable

"Ask for approval" only helps if the approval is tied to an operation. A useful approval identifies the action, the target, and the relevant content - for example: posting this draft comment to this pull request.

It shouldn't turn into a blanket authorization for every write operation in the session.

Then the tool service can verify the repository, target identifier, action type, and session policy before executing the request. If the agent attempts to close a linked issue while the session is authorized only to post a review comment, the service should reject the call. That denial should show up in logs, and when it makes sense, be reported back to the user.

Google Research work on secure agent design emphasizes constraining what agents can access and do. In production, the key question is simple: can the tool independently verify that this call is allowed, even if the model's interpretation is wrong? If not, the permission boundary is probably sitting in the wrong layer.

How can you test an agent workflow safely?

A permission design you haven't tested is just an assumption. Test both: (1) can the agent complete its real job, and (2) does the application block actions outside that job? Those are separate properties.

A system that blocks everything is "safe" in a narrow sense, but it's not a working review agent.

Use a staging repository or an isolated test project. Create a sample pull request with a realistic change and a normal issue template that includes a closing checklist. Give the agent the review task and watch the full path: what it reads, what it concludes, which tools it requests, and what the application allows.

Record requests and outcomes separately

If the linked issue stays open, that alone doesn't tell you why. The agent might never have tried to close it. Or it might have requested the action and been denied. Those outcomes point to different problems.

Record at least:

  • Which documents and tool responses entered the session, including their source information.
  • Which actions the agent requested, including target and arguments.
  • Which actions the policy allowed or denied, plus the reason.
  • Whether the review still found the expected code issue and produced a usable summary.
  • Whether any state changed outside the intended scope.

This gives you a clean separation between model behavior and application enforcement. If the agent tries an out-of-scope action and the service denies it, then the tool boundary worked (even if the model's instruction handling still needs improvement). If the service allows the change, authorization is the failure. If the agent never requests it, you haven't proven that the denial path works.

Test changes, not just a single happy path

Run variations: a checklist in an issue comment, a direction in a README, or a request returned by a connected tool. Test both permitted and prohibited actions.

For example, the agent may be allowed to post a review comment after approval but still be denied permission to close the issue.

Afterward, review results with the people who own the workflow. If your policy blocks risky actions but still lets normal work through, it will likely stick. If it's too broad, the opposite can happen: users learn to trust the agent because it usually behaves well, while it quietly retains capabilities the task doesn't need.

A basic acceptance check is straightforward: the agent completes the review, the approved output reaches the correct target, and unrelated records don't change. Keep the test as a regression case when you update prompts, tools, or permission logic. Agent integrations change over time; a new tool can quietly alter the real consequences of an older workflow.

Conclusion

An agent can use a document as context without treating it as permission. That distinction only becomes dependable when your workflow separates task instructions, reference material, and authorized actions - and when the tool layer enforces the boundary.

Start with the task's actual outcome. Give the agent only the capabilities it needs to reach that outcome. Scope approvals to a specific operation and target. Then test both successful work and denied actions. For pull request review, that might mean reading the diff and issue, posting one approved comment, and having no ability to close the ticket.

For your next agent integration, the most useful question isn't just what the model might read. Ask what it can change after reading it - and whether your application still blocks an out-of-scope action even if the model gets the instruction wrong.

Frequently Asked Questions

No. External content may contain ordinary workflow directions, relevant facts, or malicious instructions. The security concern is whether the agent treats that content as authority and can take consequential actions because of it. Preserve source context and enforce permissions independently.
A system prompt can clarify which sources are trusted and what the agent should do, but it is not a reliable permission boundary. Models can still misinterpret conflicting content. Keep prompts as guidance, then enforce allowed operations in the service that executes each tool call.
Sometimes. An agent that posts an approved review comment can save time, but that does not justify broad write access. Add a specific capability only when the workflow needs it, scope it to the target, and test that adjacent actions—such as merging or closing an issue—remain unavailable.
A refusal means the model did not attempt the action. A tool denial means the application received a request and rejected it under policy. Both can be useful, but only the denial demonstrates that the enforcement layer blocks that action when requested.

Related articles