mathewboswell.com — security-agents-least-privilege-access.md
guest@mathewboswell:~$ cat security-agents-least-privilege-access.md

Why Security Agents Need Least-Privilege Access

2026-03-27 · # security # llms # automation # iam

It is easy to give a security agent broad access. It needs to read scanner results, look at code, open pull requests, check cloud configuration, and maybe restart a service. One powerful credential covers all of that.

It also means any mistake, manipulation, or credential leak inherits every one of those permissions.

Least privilege isn't a new idea. It matters more for agents because their behavior is less predictable than a script's, and because the text they process can be shaped by people outside your organization.

Blast radius

Blast radius is the practical question: if this agent does the wrong thing, or someone steals its credentials, what's the worst outcome?

An agent with read-only access to findings can leak information. An agent that can push to protected branches can ship malicious code. An agent with administrative cloud access can delete infrastructure, change IAM policy, or disable logging.

Permissions define that ceiling. Model quality doesn't.

Separate the roles

Most security agent work breaks into four distinct activities. Each deserves its own identity and permission set.

1. Analysis

Reading findings, advisories, asset inventory, logs, and code to understand a problem.

Needs: read access to specific data sources. Doesn't need: write access to anything except its own output, such as ticket comments.

This is where most agent value lives, and it can run with very limited risk.

2. Code changes

Proposing fixes as branches and pull requests.

Needs: permission to create branches and open pull requests in specific repositories. Doesn't need: permission to merge, approve, push to protected branches, or change repository settings and CI workflows.

Branch protection and required reviews do the heavy lifting here. Make sure the agent's identity can't bypass them.

3. Deployment requests

Asking for a change to be rolled out.

Needs: permission to submit a request into the normal deployment system, such as a change ticket or GitOps pull request. Doesn't need: direct access to deployment credentials or production clusters.

The request enters the same pipeline as any other change, with its checks and approvals.

4. Production execution

Performing actions directly in a live environment.

Needs: narrowly scoped permission for specific, pre-approved, reversible actions on specific resources, if it needs any at all. Doesn't need: broad administrative roles.

For many organizations, the right amount of autonomous production execution is very small or zero.

Credentials matter as much as permissions

Even well-scoped permissions are dangerous if the credentials holding them are long-lived and widely accessible.

  • Use short-lived tokens. Workload identity federation, OIDC-based CI credentials, and cloud role assumption avoid static keys.
  • Scope tokens per task. A token for opening pull requests in one repository shouldn't work in all of them.
  • Keep secrets out of model context. The model should never see raw credentials. Tools it calls can hold them; the prompt shouldn't.
  • Rotate and revoke. Know how to cut off an agent's access quickly, and practice it.

Enforce at the platform

Prompt instructions aren't access control. If the only thing stopping an agent from modifying IAM policy is a line in its system prompt saying "don't," that's a suggestion.

Enforce boundaries where the agent can't override them:

  • IAM policies and role boundaries in the cloud provider
  • Repository permissions and branch protection
  • Tool allowlists in the agent framework
  • Policy-as-code checks on proposed changes
  • Network restrictions on what the agent can reach

Monitor the agent like any privileged identity

  • Log every action with the agent's identity
  • Alert on actions outside normal patterns, such as unfamiliar repositories or unexpected API calls
  • Review its permissions periodically and remove anything unused

Unused permissions are pure risk. Agents accumulate them just like human accounts do.

Start narrow

Begin with analysis-only access. Add pull request creation for a few repositories. Expand only when there's evidence the agent's work is reliable and the controls around it hold.

The point

Least privilege doesn't make an agent less useful. It makes it safe to use. Separate the roles, scope the credentials, enforce boundaries at the platform, and the worst case for any single mistake stays small.

guest@mathewboswell:~$ cd /posts
guest@mathewboswell:/posts/security-agents-least-privilege-access2026 — System 1.0