Insights

Least privilege for AI agents in a multi-tenant SaaS

A common prototype shortcut is to give an agent a token, expose all tools and constrain behaviour with a prompt. That makes a demo easier. In production it creates a problem: intent written in prompts becomes the main barrier between a model error and the full capability of the account.

Least privilege for an agent does not end with a read-only role. At minimum, we should constrain five things: tools, operation type, target resources, data and the lifetime/identity of access.

1. Limit the tool set

An agent analysing advertising performance does not need user-management functions. An agent preparing a compliance report does not need unrestricted shell access. An agent organising files in one directory does not need the whole filesystem.

The broader the tool catalog, the larger the surface for:

  • selecting the wrong tool;
  • prompt injection leading to an unwanted action;
  • unexpected combinations of tools;
  • accidental data exposure;
  • configuration mistakes at the model layer.

The first question should therefore not be “what can this API do?” but:

which three or five operations does this agent need for this specific job?

Everything else can remain invisible.

2. Separate read, write, operational effect and destruction

“Has access to campaigns” is too broad.

For our tooling, an operation model is more useful:

Scope Meaning Example
read retrieve state and reports get spend, status or resource list
write prepare or modify configuration create draft, rename, change a parameter
operate activate a business consequence enable a campaign, publish, start synchronization
destructive delete, detach or revoke delete a resource, remove access, perform difficult-to-reverse change

An agent can prepare a configuration without permission to activate it. It can read billing without changing payment settings. It can draft a message without permission to send it.

That boundary is often where useful autonomy lives.

3. Tool scope is not enough — constrain the resource too

A permission such as:

campaign.write

is still broad if an operator has ten accounts but the agent should work on only one.

Where practical, authorization should consider:

The authorization decision includes the user, agent, function, operation type, tenant/account/project, resource and task context.

who
+ which agent
+ which function
+ which operation type
+ which tenant/account/project
+ which resource
+ which task context

Our internal Brillnet Ads MCP requires explicit account/customer identifiers inside an allowed boundary. A general query should not simply guess which account to operate on.

This is particularly important in multi-tenant SaaS. Selecting the wrong tenant can be more serious than a reasoning mistake inside the model itself.

4. Limit input and output data

Least privilege also applies to data.

An agent may need:

  • aggregate spend, not the full list of user data;
  • task status, not every attachment;
  • confirmation that a credential exists, not its value;
  • a person identifier, not their entire profile;
  • selected document fields, not the whole repository.

If a tool can return a minimal object, return the minimal object. Do not expose a complete provider payload to the model only because the API makes it available.

The same principle applies to logging: an audit trail should contain enough evidence, not a duplicate of all source data.

Read: AI agent audit trails

5. A credential should not live longer or wider than necessary

A long-lived administrator token placed in every component's environment is easy to set up. It is also difficult to constrain safely.

We prefer a pattern closer to:

  1. The agent does not receive the secret.
  2. The gateway verifies identity, scope and resource.
  3. It obtains a short-lived credential.
  4. It performs one permitted provider call.
  5. The secret never enters the model response or audit record.

According to its documentation, our internal Ads MCP obtains short-lived provider tokens at call time. Credential material is handled outside model context and is not written to application logs.

Check permission at execution time

An agent may have started a task while the operator had a certain role. Ten minutes later, that role may have been revoked. A long workflow should not assume that permission from the start of the session still applies.

For material operations, authorization is checked when the tool executes.

The same applies to approval. Consent for one action is not permission for arbitrary subsequent actions.

A prompt is not an ACL

An instruction such as:

you may only read data and must never delete anything

can be a useful behavioural rule. It does not replace a control that technically blocks DELETE.

If the model can access a destructive tool and a credential that permits deletion, that capability exists. The prompt merely asks the model not to use it.

A practical separation is:

  • prompt: what the agent should do;
  • authorization/policy: what the agent is allowed to do;
  • provider/API role: what the technical identity can do at the provider.

The safest arrangement is when all three layers are aligned but no single one is the only control.

Profiles instead of one super-agent

In our internal advertising tool, we separate read/planning capabilities, campaign-management capabilities and an owner-level surface for rare administrative operations.

The names are not important. The point is that ordinary analysis should not run continuously with the highest privilege level.

A similar design elsewhere might be:

Profile Permitted work Additional boundary
research-agent search, read, summarize no state changes
operations-agent read, create a draft, update approved fields operational scope
admin workflow administrative operation separate invocation, identity/scope, mandatory approval, narrow time window

A compromise or mistake in one agent then does not automatically grant access to every class of operation.

Constrain filesystem and “universal” tools

Two categories deserve particular attention.

Shell / command execution

An unrestricted shell can bypass most of a carefully designed tool model. If an agent can execute any command as a broadly privileged OS user, fine-grained scopes elsewhere offer limited protection.

Purpose-built tools or allowlisted commands inside a constrained environment are usually easier to reason about.

Filesystem

An agent that needs to write a report to /workspace/reports does not need /etc, an operator's home directory and CI secrets.

In our internal Ads MCP, file operations are limited to approved server-side locations or bounded payloads. Arbitrary system paths are rejected.

A low-level gateway still needs scopes

Sometimes a general gateway is useful for new provider endpoints before a dedicated tool exists. It must not become an escape hatch.

It should classify:

  • HTTP method;
  • endpoint;
  • resource;
  • payload characteristics;
  • whether the operation writes or destroys state.

Only then should it map the request to required permissions.

If raw_request can use a full-access token without policy checks, it is effectively administrator access regardless of how carefully the other tools were scoped.

Temporary elevation for high-risk actions

Instead of assigning a broad scope permanently, a system can use controlled elevation:

  1. agent prepares the operation;
  2. gateway detects that higher privilege is required;
  3. a person approves the exact parameters;
  4. system grants permission only for that operation or a short period;
  5. permission expires after execution;
  6. audit trail records approval and outcome.

This is not required everywhere. For critical operations it reduces the time during which broad permission exists.

Read: When should an AI agent require human approval?

Capability inventory template

Before production, write the boundary down:

Agent / workflow Tool Operation Resource Data Approval Credential Audit
campaign reporting Ads report read account A metrics without PII no short-lived yes
campaign preparation campaign tool write account A configuration no/conditional short-lived yes
campaign activation campaign operate operate campaign X budget + status yes short-lived yes
resource deletion admin tool destructive specific resource minimum yes elevated yes

This is much more useful than writing “the agent has access to Google Ads”.

Anti-patterns

One API key for the whole system

Roles cannot be separated cleanly and access for one workflow is difficult to revoke.

The same tool set for every agent

The broadest function in the catalog becomes part of the risk surface of every agent.

“Read-only” only in the prompt

If the backend still accepts writes, read-only is a request, not a control.

Automatically expanding scope after a 403

Missing permission is a reason to stop and make a decision, not to “retry as admin”.

Credentials in model context

A model does not need the value of a secret to ask a trusted gateway to perform a permitted call.

Least-privilege checklist for an agent

  • The agent sees only tools required for its role.
  • Read and write are separate.
  • Activating an operational effect has a different scope from preparing configuration.
  • Destructive operations have an additional barrier.
  • Permission is constrained to the tenant/account/project/resource.
  • Ambiguous target resources are not guessed automatically.
  • Tools return the minimum necessary data.
  • Credentials stay outside model context.
  • Tokens are short-lived where practical.
  • Authorization is checked at execution, not only at session start.
  • Filesystem and shell access are constrained or replaced with purpose-built tools.
  • A raw gateway does not bypass policy.
  • Privilege elevation is explicit and auditable.
  • Access can be revoked centrally.

Worked example: quality reporting for one production line

Consider a proposed workflow, not a deployment reported here. A manufacturer wants a morning summary of nonconformities for line L1. The agent combines counts, statuses and action deadlines. It does not decide whether to release a product. The quality manager owns the process; the application administrator owns access configuration.

Start with permission to read L1 records, excluding attachments and employee details. Save the report in an internal directory. Do not grant functions for closing nonconformities, changing inspection results or sending customer communications merely because the same API supports them.

If the team later needs corrective-action tasks, add permission to create a draft for a named team. Creating that draft must not change product status. Update the access inventory and identify who deals with an incorrectly assigned task. The identifiers in this example are design assumptions, not Brillnet deployment results.

What MCP authorization establishes

This guide uses MCP specification version 2026-07-28. Its HTTP authorization model requires checking that an access token was issued for the intended server. A valid token for another service should not grant MCP access. MCP security guidance also addresses forwarding client tokens to downstream APIs without proper validation.

That still does not determine whether a user may read customer B's record. Application authorization must resolve the relationship between identity and target resource. OAuth scopes and tenant filtering cover different parts of the boundary. Both matter. Check protocol details against the versions actually used by your client and server; “MCP compatible” alone says little about access restrictions.

Verify refusal as well as success

A correct report proves that the permitted path works. It does not prove that other paths are closed. During acceptance, retain results for a small set of concrete checks:

  • request the same object type from another tenant;
  • call a write function through the reporting profile;
  • execute after the operator's role has been revoked;
  • access a file outside the report directory;
  • attempt the same forbidden operation through a general gateway.

Expect refusal without a state change or resource-data disclosure. Record the check identifier, policy version and outcome, excluding secrets and full customer records. These are suggested acceptance checks for this workflow, not a complete security testing programme.

Keep an owner for permission changes

Access tends to grow incrementally: another connector, one exception, an additional directory. Ask whether the agent still performs the same job. A connector that supports sending messages must not silently extend a reporting profile.

The process owner approves the business need. The administrator provisions and revokes access. The security owner examines exceptions and bypass routes. In a small company, one person may hold several roles, but the decisions should remain traceable. Set a review interval based on change frequency and possible consequences. Remove installation privileges once installation is complete.

Tomorrow, inventory one agent. Remove a permission that its task does not require and verify refusal outside the approved boundary. That provides useful evidence without requiring a complete architecture replacement.

Evidence and limits

OWASP guidance supports restricted tools and authorization checks. NIST publishes a security-control catalogue. Our read/write/operate/destructive model and worked example are engineering recommendations, not legislation or a compliance certificate. Determine applicable organisational obligations separately. Internal Ads MCP documentation, version 1.0 dated 28 July 2026, describes the cited control design; it does not independently prove production operation for a customer.

Boundary

Least privilege reduces the maximum impact of an error or abuse. It does not guarantee that an allowed operation is substantively correct. We therefore combine it with input validation, approval for high-impact actions and an audit trail.

Return to the safe AI agents guide or see Brillnet Security.

Two synthetic tenants, one narrow task

In a dedicated demonstration environment, give an assistant permission to read one approved procedure in fictional organization A and prepare a draft. Exclude approval, publication, permission changes and access to organization B. The enforcing service establishes organization context from the authenticated actor and permitted relationship; a changed identifier in the request is not authority to use another organization's data.

Test the permitted read, an excluded approval and a request for organization B. For each case, record the expected outcome and inspect the actual result. The refusal cases must leave the prohibited state unchanged and return no unrelated tenant data. Keep the policy version and the minimum event metadata needed to reconstruct the check, while excluding credentials and unnecessary document content.

Include a harmless instruction inside the synthetic source asking for an unrelated export. Treat it as document content. The approved task and server permissions remain the basis for the allowed operation. This shows how prompt handling and enforced access need to work together in the proposed design.

In Pulsar, record the requirement, risk, action and fictional evidence for review. This tests how your team documents the control. It does not mean the public Pulsar trial exposes an MCP gateway or implements every agent permission in your architecture. Review the 14-day trial, required payment method and cancellation terms, and agree an external integration separately if you need one.

Layers of scoped permissions between an AI agent and a set of tools

Sources

Review terms and start the 14-day trial

Audit an AI operation: authorization, result and verified state

Food-production CAPA: from a finding to effectiveness review

A pharmaceutical SOP changed: check the training and source version