r/opencode • • Nov 01 '26

We gave AI agents terminal access. Do we actually trust them that much?

I've been building and testing AI coding agents, and honestly, the amount of access we give them is a little concerning. They can run shell commands, read sensitive files, delete stuff, and execute scripts without us necessarily knowing what they'll do next.

And with prompt injection, even a seemingly harmless task can take an unexpected turn.

I've been working on a security platform to add a security layer that watches what agents actually do and steps in when an action looks risky.

Curious how you guys handle this. Do you stick with built-in permissions, use sandboxes, or have your own way of keeping agents in check?

0 Upvotes

17 comments sorted by

3

u/horrbort Nov 01 '26

AI agents are a lot smarter than humans. If there is a problem they are more likely to catch it than you!

0

u/Xevora_odd Nov 01 '26

Do you actively use AI agents to write code?

1

u/horrbort Nov 01 '26

I am a CTO of a tech startup so I know what I am talking about

2

u/Xevora_odd Nov 01 '26

Being a CTO doesn’t make prompt injection disappear. You said AI agents are “smarter than humans” and will catch problems better than we will. Cool theory. Now explain how that works when the agent has terminal access, can delete files, run arbitrary commands, and is one cleverly injected instruction away from doing something catastrophic. Because “I’m a CTO” isn’t a security control. It’s just a title. And right now it’s looking like a substitute for an actual answer.

1

u/horrbort Nov 01 '26

We run each prompt through jev before it is passed to the agent that makes it safe

1

u/Xevora_odd Nov 01 '26

Got it — you’re filtering prompts through “jev” before they reach the agent. That helps on the input side. But the main risk with agents that have terminal access is what they do after that. Even a clean prompt can still lead to dangerous commands or installing risky dependencies in later steps. That’s why we built a layer that watches the actual actions — the commands they run, the packages they install, and other behavior — so it can step in when something looks unsafe. How do you handle that part in your setup?

1

u/horrbort Nov 01 '26

As I already explained jev handles the safety. If the prompt is safe there is no way an agent would do something bad since it was already reviewed. Looks like you don’t know how jev works haha

1

u/Primary-Meal-2264 Nov 02 '26

Sandbox

1

u/Xevora_odd Nov 02 '26

What if there are tools that can handle this kind of security by just installing a single npm package. Will you still setup sandboxes? I mean they are bit complicated.

1

u/Primary-Meal-2264 Nov 02 '26

I'd still use a sandbox. The whole point is to make sure the agent can only access what you explicitly allow it to access, and only reach the network destinations you permit. You don't want to learn the hard way after it runs something like ‘rm -rf’ on a path it shouldn't touch, or wipes your entire disk by accident for some ridiculous reason.
Instructions are just soft suggestions. AI agents are essentially probability machines. No matter how carefully you write your system prompts or rules, there's always a chance they'll ignore them, misunderstand them, or get manipulated by prompt injection. You need hard boundaries that enforce what they can and cannot do, rather than just asking them nicely.
Personally, I also wouldn't feel comfortable giving certain models access to my host environment, especially those from providers with questionable data practices or models that might scan unrelated or sensitive files for whatever reason, including model training.
I'm not sure what your “security platform” does exactly, but I wouldn't blindly trust 3rd-party tools to manage AI agents either. There's a reason supply chain vulnerabilities are included in the OWASP top 10 for llm applications. You're essentially introducing another layer of software that itself needs to be trusted and secured.
I wouldn't compromise on security just because setting up a proper sandbox seems a bit complicated. You're already using AI agents anyway. Why not just ask one to help you build the sandbox? :D
If you want a starting point, there's an opencode docker sbx you can try and build on, although you might lose some flexibility depending on your setup.
Personally, I have quite a few customized plugins and mcps, so I built my own sandbox from scratch using podman. I spin up a separate opencode server for each working project, while the host machine only runs the tui client and connects to those servers. I also wrapped everything in a simple cli workflow: ‘oc up <working-project>’ to initialize the environment, ‘oc’ to connect and start working, and ‘oc down’ to tear everything down.
The key is to think about your actual day-to-day workflow and tech stack first, then design your sandbox around those requirements instead of blindly copying someone else's setup.

1

u/Xevora_odd Nov 02 '26

Totally agree on hard boundaries — sandboxes are essential.
Our platform isn’t another AI model. It’s a local security layer you install via npm that hooks into different AI agents. It runs completely on your machine (no database, no third-party auditing) and watches the actual actions the agent takes in real time — commands, file access, network calls, etc. — so it can step in when something looks risky.
Sandbox = strong containment.
Our layer = runtime guardrails + visibility on top of it.
They complement each other well. You keep the isolation you already trust, and get an extra safety net that reacts to what the agent is actually trying to do.
How does the monitoring side work in your podman setup?

1

u/JoleneAtCynapsa Nov 04 '26

I’d start by asking what the agent can reach from that terminal. If it’s just running tests, I’d want it to have access to the repo and whatever the tests need. Can your tool block a connection to an internal service before it happens, even if the request comes from a script the agent launched?

1

u/Xevora_odd Nov 05 '26

That's exactly the kind of scenario it's designed to address. It evaluates intercepted actions through agent hooks and CLI adapters, including network-related actions.

One important distinction is that catching an agent's direct network request is different from catching a script or subprocess it launches. Coverage depends on how that process executes and whether its network activity passes through an enforcement point it monitors.

The focus is to make these boundaries explicit so teams can understand exactly what it can and cannot enforce, rather than giving them a false sense of security.

1

u/Unlucky-Sherbert795 27d ago

hello OP! Sandboxing plus least-privilege is the baseline, but the prompt. Injection risk is real since the agent can get hijacked mid-task. We looked at a few runtime tools when evaluating this, sysdig and upwind both watch actual behavior and flag risky actions, which beats trusting static permissions alone.

1

u/Xevora_odd 27d ago

Yeah, completely agree. Static permissions alone aren’t enough once the agent can be steered mid-task. Runtime visibility into what it’s actually trying to do is the more useful layer. That’s the angle we’ve been focusing on too.

2

u/Versalkul Nov 04 '26

No, they can go ham in that docker container of mine. I'll be fine ^