swiftapplications

Agent approvals & safety

Least privilege for AI agents: scoping keys, files and actions

Apply least privilege to AI agents in five dimensions (keys, files, actions, time and network) with concrete settings for Mac developers and business tools.

Updated 8 October 2026 3 min read

The short answer

Give an agent the least it needs, in five dimensions: keys (restricted, read-only, revocable), files (the project folder, with secrets denied), actions (read freely, propose changes, never execute them unapproved), time (short-lived access) and network (only the hosts it needs).

The five dimensions

  • Keys: restricted keys such as Stripe rk_, read-only tokens, one key per agent so revoking one doesn’t break the others.
  • Files: start agents in the project folder; deny .env, secrets/, ~/.ssh.
  • Actions: read, propose, approve, execute; the agent only gets the first two.
  • Time: access that expires, and proposals that lapse if nobody decides.
  • Network: sandbox modes and firewalls that limit where an agent can send data.

In practice

The quickest wins: move keys out of files, switch agents to read-only by default, and add an approval step for the few actions that matter. Most agent tasks are reading anyway.

The safe way to do this

MoltenRock

The encrypted vault for your API keys and AI agents

Your keys sealed by your Mac’s Secure Enclave, handed only to the local agents you approve, never written to a .env file. Free for Mac.

Get MoltenRock, free

Questions developers ask

What is least privilege for AI agents?

Granting an agent only the keys, files, actions, time and network access its task needs.

Should each AI agent have its own API key?

Ideally yes, so you can revoke or audit one agent without affecting the rest.

How do I give an agent write access safely?

Let it propose changes, and have a person approve each one before a trusted component executes it.