r/devsecops • u/iamjessew • Oct 21 '26
What controls are you putting on coding agents on dev laptops?
Agents like Claude Code and Cursor can run shell commands and edit files with the dev's full permissions. I'm curious what security teams are actually enforcing today:
- Sandbox or VM, or running on the host?
- Command allowlists?
- Egress controls?
- Secrets kept out of reach?
- Logging? And how are you rolling it out without devs just turning it off? What has worked and what got pushback?
22
Upvotes
1
u/fell_ware_1990 Oct 21 '26
Yes, on demand dev boxes which we control.
All other settings are loaded from the repositories.
We have the normal MCP’s setup in azure functions with Entra auth, so we could still offer these functions and make sure who ever starts the agent get’s his or her RBAC where it’s applicable and just don’t expose write access at all for some tools and scan for bad actors our selfs.
We basically do not allow most write actions except the non scarry ones, but still as soon as a few or more of the same requests come at once it blocks. So yes, they can change a ticket status, they can do a few af once. More needs a little pause, so agents can’t go full blown at once.
Everything also goes through our gateways, so we can handle caching, TTL, etc. But also do scanning and policies.
1
u/bezcurhq Oct 22 '26
On the rollout question, and usually_guilty99's point about policy living in the repo: for Claude Code, ship the restrictions as managed settings (a
managed-settings.jsonvia MDM, or the admin console) rather than repo config. Managed settings sit above user, project and --settings, so neither the dev nor anything the agent edits in the repo can loosen them. For logging, put the OpenTelemetry env vars in that same managed file. You get atool_decisionevent per tool call, and withOTEL_LOG_TOOL_DETAILS=1the actual bash commands. Pin the exporter selectors there too, otherwise a project file can switch a signal to none.2
u/therealrrc Oct 22 '26
Put everything on the desktop and hope for the best
1
u/usually_guilty99 Oct 22 '26
Interesting setup. One thing I'd question is loading settings from the repository. If the agent can modify the repo, how do you prevent it from changing the policies that govern its actions?
Also, do those restrictions extend beyond MCP to shell commands and direct API calls?
I'd want to deliberately test forbidden actions and verify they were blocked, with the evidence recorded somewhere the agent cannot modify.
1
u/endor_robert Oct 22 '26
OK, my usual disclosure: I work for Endor Labs, which has a commercial offering in this space.
We have rolled out our own product internally that uses the hooks framework in most harnesses. I'm a marketing engineer, but I use Claude code, etc., to demo our stuff and vibe-code apps for demos (with increasingly silly features and functions).
Essentially, we have a policy that runs on every event the harness's hooks framework captures, then returns an allow, block, or ask response. Our internal security team manages the policy, which controls file access, tool calls, MCP servers, etc.
You can absolutely code this yourself; the JSON the hook passes to the script is well documented and easy to use. Building a policy engine is work, of course.
1
u/fykup Oct 22 '26
One approach I'm exploring is reducing the agent's permissions and autonomy rather than trying to sandbox everything it can do.
I'm building an open-source local-first tool that separates repository context preparation from AI reasoning. The AI chat never gets direct filesystem or shell access through the tool. Developers explicitly choose what context to share and review proposed file changes before applying them.
It's less automated than Claude Code or Cursor, but that trade-off may make sense in environments where direct repository access is restricted.
I'm curious whether security teams see this kind of human-mediated workflow as a useful alternative, or whether they still prefer sandboxed agents with centrally enforced controls.
1
u/coldflame563 Oct 22 '26
Just don't write policy docs for humans and not AI. I'm seeing a lot of that where cybersec is trying to control things as if humans are doing it, when they're not. Or forgetting the point of the tooling is to access things, especially local things like docker containers and it's OK if there's data there to be read.
1
u/radim11 Oct 23 '26
Personally I run Claude Code in a docker based sandbox with filesystem restrictions, an outbound allowlist and scoped credentials through a proxy outside the sandbox. The agent gets placeholders, and the proxy adds the real credentials only when the request matches the policy.
We're building Stashbase for this, so that's my connection. Keeping Claude's login and session state between runs has helped with the friction. I don't want to set everything up again every time I start working. We're basically handling all the bullets you shared.
Are your devs mostly working locally or do you use remote VMs?
1
u/Few-Compote-2693 Oct 24 '26
Surprised no one mentioned we only give them read-only?
1
u/Successful-Sound9270 Oct 31 '26
secrets first since the agent runs with the devs access, so long lived keys move out of dotfiles into short sso sessions. leave hush security for later and a mdm script shows which agents are even on the laptops..
1
u/drdavidawheeler 29d ago
Hi, I work at OpenSSF on security. We have a free course that discusses this at a high level (LFEL1012) but probably not the specifics you're looking for. This is an area where people are DEFINITELY doing different things!
So, I'll speak for myself.
I *NEVER* let an AI touch my host in my "real" account. Never never never. That's *inviting* problems; if it goes out of control, it's too difficult for me to be sure I got it back *in* control.
My AI *harnesses* always run in a VM, at the *VERY* least. I also *never* let it run from my home directory, I always start in a subdirectory. Most harnesses try to restrict "this directory down" so this is a really easy way to restrict access to data they shouldn't get. It also makes the agents better; they don't get confused/cross-contaminated with data from unrelated projects.
I also normally run "nono". Nono lets you restrict what a program (typically an AI agent) can do. It also has other functions, like only giving fake certs.
I keep my secrets on my host. The VMs generally don't get secrets, or they get highly attenuated "secrets". E.g., I have a no-permission GitHub token that's enough to read public GitHub data; gh requires *some* token and is happy with that one. My process is that the AI can edit its local copy all day, and make commits (though I sometimes edit them), but only *I* the human can push. The harnesses don't have the tokens/privileges to push, so even if they tried, they couldn't unless they broke through the VM and nono.
That works for accessing Claude Code, Gemini, etc.
I also run local models on my Mac M5 running MacOS, with VMs on top running Linux. Linux is what I live in; the host is for occasional authorized commands (think "admin"). One problem: the Linux VMs *cannot* access the GPU, so Linux VMs can't usefully run AI models locally. That means that while the AI *harnesses* run in Linux, the underlying AI model and inferencing calculations must be done on my Mac when I do it locally. I instead created a special MacOS account "_infer", and use the MacOS sandboxing to give it very limited privileges: no Internet, only a few local ports to serve my local VMs, and almost no file access except for the model files. It certainly can't access my normal user home directory. For good measure I also changed the permissions of my Mac home directory so that even if the sandbox fails, my MacOS home directory's account can only be viewed by me (and root), not by another account like _infer.
I hope that helps!
1
u/rglauser 15d ago
Keep secrets out of reach first, that's the part that hurts when it goes wrong. Pull long-lived keys out of env files and dotfiles and hand out short-lived creds from a vault, then limit egress to the repos and registries the agent needs. Sandboxing everything is where the pushback comes from and devs just switch it off. Which agents are you seeing most, Claude Code or Cursor?
0
u/fuckinhategoogle Oct 31 '26
the local MCP question upthread is where the gateway stops helping, since a local server never touches it. i'd let people register local MCP servers instead of banning them. a ban just pushes them off the managed box and you lose sight of them. it also answers your pushback question, devs keep their tools and you get a list. a tool like ox security keeps an inventory of which coding agents, MCP servers, skills and packages your devs are running, and what permissions and data each one can reach. Pillar Security comes up for this too.
2
u/[deleted] Oct 21 '26
[removed] — view removed comment
1
u/[deleted] Oct 22 '26
[removed] — view removed comment