← All articles
AI security

Least privilege for AI agents and tools

Limit what an AI tool can access and enforce permissions where actions are executed.

Scope tools to a clear job

An assistant that checks an order needs a narrow lookup for orders the user can access. Separate that from changing shipping addresses or issuing refunds. Keep operations with different consequences behind distinct permissions and apply those permissions to the actual record.

Authorize each action at the server

Treat model-proposed tool calls as input to validate. Resolve the user identity and resource scope independently, then check the operation before executing it. Use synthetic accounts with different privileges to verify that the same tool request succeeds or fails according to the account and resource involved.

Map permissions to an example workflow

For an order assistant, define what a customer can read, what a support agent can edit, and what requires approval. A read-only order lookup should require the requesting user to have access to the selected order. Address changes and refunds deserve their own operations with distinct eligibility checks. Give each tool a narrow purpose that makes its allowed effect easy to describe.

Bind authority to the request context

Use the authenticated session to identify the requester. Resolve account or workspace membership on the server. Treat any account identifier proposed by the model as a lookup value only, then verify that the caller can use it. Apply the same check for background processing so execution cannot silently move to a more privileged identity than the user who requested the action.

Review reads, writes, and bulk operations separately

Viewing one order, exporting all orders, and editing an order have different scopes. Review access by operation and resource, including any pagination or bulk function. Return only fields the task needs. For a delivery-status lookup, a full address or payment record may be unnecessary even when the underlying service has access to those fields.

Verify the control with an access matrix

Create synthetic users from two accounts and a service identity with a limited role. For each supported operation, check allowed records and records outside the caller’s access. Verify denied calls leave application state unchanged. Store the matrix with the tool contract and repeat the test when new roles, new routes, or new tool arguments are introduced.