Blog & Insights

How do you secure the agents your teams run?

Agents act, so securing them is a blast radius problem: sandbox them outside the model, limit what they reach, give them their own identity, and keep a person on risky actions.

In Part 1 I wrote about shadow AI, the first of two security questions I kept hearing at a technical leadership summit I attended recently. This one’s the second: how do you secure the agents your teams are starting to run?

What makes agents different is that they act. An agent that holds credentials can read your data, call your APIs, push code and send email, all while reading content you don’t control, like a web page, an inbound email, or an issue someone filed on a public repo.

Simon Willison calls the dangerous combination the lethal trifecta, an agent that has:

  • access to private data,
  • exposure to untrusted content,
  • and some way to communicate externally.

With all three, a well-crafted bit of text in that untrusted content can trick the agent into sending your private data somewhere it shouldn’t go. There’s no reliable fix for prompt injection at the model level today, so the practical move is to make sure no agent, or chain of agents handing work to each other, has all three at once. And an agent that reads untrusted content and can change things can still do damage without sending anything out.

The options

1. Sandbox the agent, and make sure the sandbox lives outside it. An agent told to stay inside a folder is relying on its own judgment, and prompt injection goes straight after that judgment. A container or VM enforced outside the model is a boundary the agent doesn’t get a vote on.

  • A sandbox only contains what you leave out of it. Keep your SSH agent, cloud credentials, the Docker socket, and wide open network access out. Dev containers forward some of those by default.
  • Built-in sandboxes in coding agents count, if you check what they cover. Some only wrap shell commands, and many let the agent ask to run outside the sandbox or read credential files by default.
  • A shell sandbox does nothing to limit the remote MCP servers or connectors the agent uses.

In practice, getting agents to run as well inside a sandbox as on a developer’s machine is harder than it sounds. Tooling is missing, builds and tests that need databases, browsers, or their own containers take extra setup, network allowlists break installs until you’ve found every domain, and signing in from inside is clunky enough that people mount their credentials and defeat the point. I’ve also seen a Claude Code update break sandbox setups that worked fine the day before.

The bigger risk is that when the sandbox gets in the way, people turn it off and run the agent on the host. A lot of the job is making the sandboxed path good enough that nobody wants to skip it.

2. Control what the agent can reach. An outbound network allowlist narrows the “communicate externally” leg, but it doesn’t close it, since any allowed destination that accepts writes, or even the URL of a plain read request, can carry data out. A logged tool and MCP server allowlist limits what the agent can do, though an allowed shell can still do almost anything, so restrict what each tool can reach. Pin the servers you run, watch remote ones for changes, and treat whatever a tool returns as untrusted too.

3. Give agents their own identity. Most teams, ours included, have only partly done this. An agent using a developer’s credentials inherits everything those credentials grant. An agent with its own identity can be scoped to the task, given short-lived credentials, and shut off without touching anyone’s account.

4. Keep a human in the approval path for anything high-impact or hard to undo. AI proposes, a human confirms, then the AI executes. The human should see the actual command or diff, and the approval should be enforced outside the agent and tied to that exact action.

The separate IdP idea

The most interesting idea I heard at the summit came from a CEO I met there: host your agents’ identities in a completely separate identity provider from the one your employees log into. The appeal:

  • Phishing isolation. A phished employee account doesn’t directly inherit agent permissions, as long as the IdPs are administered separately and that account can’t reach the agents’ configuration or credentials.
  • Cleaner audits, and one place to review and shut off agents, though downstream tokens and API keys need separate revocation.

The baseline for an agent that isn’t a person is a workload identity or service account in the IdP you already have, and that baseline is improving quickly. Microsoft Entra now has a dedicated identity type for agents, with a person or group sponsoring each one, and FusionAuth has added delegation that records both the person and the agent acting for them. We’ve been testing both.

A separate IdP goes further. It’s a strong fit for an internal system that needs to keep running regardless of who’s employed, or that needs permissions most employees should never have. It’s a harder fit for an agent acting for a specific person, since keeping the link back to that person across two IdPs takes integration work, and unless offboarding is automated across both, access set up for someone can outlive their employment.

Where we actually are

Most of our agents at Frogslayer use the developer’s own access, since repo access is managed per person. Our baseline for code integrity is the repo itself. Main is protected on every repo, admins can’t bypass it, and changes need a second person’s approval, which resets when new commits land.

That makes it much harder for a bad change to reach main, but review happens after the fact. Anything an agent posts is visible right away, CI on its branch can run before anyone reviews the change, and none of it stops data from leaving, so it has to sit alongside the options above. Pipelines and cloud integrations run on service accounts, and some agents have their own restricted IAM roles. The separate IdP is where I’d put our next agent that needs to outlive anyone’s employment or touch something sensitive.

Where to start

If you lead a technical team:

  • Consider sandboxing as many agents as you can, starting with any that read outside content or run unattended.
  • Protect main and require a second person’s approval, with approvals that reset on new commits, no admin bypass, and someone other than the last pusher approving. Remember that an agent using someone’s login can approve as that person.
  • Hold connectors to least privilege, read-only unless the job needs writes. Check them as a set, too. If an agent can see private data, one connector that reads outside content plus another that can send something out completes the trifecta.
  • Work through what each agent can reach and whose credentials it’s using.

It’s something we can help with as part of any engagement with us, since it’s hard to get real value out of agents until you’re comfortable with what they can touch.

If you feel stuck or have questions, I’m happy to talk through what’s worked for us at Frogslayer.

Common questions

What is the lethal trifecta?

It is Simon Willison’s name for an agent that has access to private data, exposure to untrusted content and some way to communicate externally. With all three, text planted in the untrusted content can trick the agent into sending private data out, so no agent or chain of agents should have all three at once.

Is an instruction to stay inside a folder enough?

No. That relies on the agent’s own judgment, and prompt injection goes straight after that judgment. Use a container or VM enforced outside the model, and keep credentials, the Docker socket and open network access out of it.

Should agents use a developer’s credentials?

It is common, ours included, but an agent using a developer’s credentials inherits everything those credentials grant. An agent with its own identity can be scoped to the task, given short-lived credentials and shut off without touching anyone’s account.

Related service: Security & Compliance

More like this, in your inbox. Subscribe for our latest thinking, resources, and events.

Get started

Want results like these?