r/opencode • • 2d ago

Isolated Environments?

Is anyone overly concerned with providing opencode isolated environments or do you just run it on your every day machine and don't worry about it?

Is there any fear of it running of and nuking your dev machine?

5 Upvotes

16 comments sorted by

2

u/CycleTourist1979 2d ago

I have a separate linux account with limited access (no sudo) and "su" into it for opencode. It can't get on github, there are no credentials there. Got it to change its .bashrc the other day - wouldn't want that happening on my main account. I also run it on a separate machine which I can rdp into (I keep an IDE on there to review code / fix things) and I don't particularly want the endless builds / test runs using the resources of my main machine.

1

u/evan-nielsen 2d ago

This is kind of what I was thinking. I have a laptop that is pretty decent (couple years old). Beef up the RAM to 32GB. Have open code running on that with limited access to the machine itself. My models are running on a separate machine. Should be able to use vs code from any other machine to SSH in and see what is going on.

Do you have recipe for how to get everything setup so that opencode can't take over and use the processor for evil?

1

u/CycleTourist1979 2d ago

I just set up an account using useradd, then created a group and shared its home directory so I can push to github via the main account easily.

Can't stop opencode doing evil thought :) i suspect you could limit the internet locations that account can access although for my purposes I just don't want it having access to my customer's remote repository.

I actually have extra accounts on there "opencode" (access via an api / fireworks) where I give it access to all the customer code and "opencodego" which I use just for isolated tool and library building.

1

u/RepulsiveRaisin7 2d ago

I made a little container isolation tool. Running direct on hardware is sketchy, I try to avoid it. Most permission systems won't actually protect you against bad shell commands

1

u/evan-nielsen 2d ago

How does this tool differ from docker sandboxes? What makes it better?

1

u/RepulsiveRaisin7 2d ago

I've avoided sbx because it isn't open source, so I can't answer that. But I've taken all the lessons from maintaining tons of project-specific container setups as well as using devcontainers for many years and came up with a (in my mind) solid design. The core is built around mise, with apt packages as an escape hatch. The config format is flexible and extendible and launches are fast. It is also intentionally limited, there are no dockerfiles and no post-launch scripts, and containers are ephemeral, they shut down when the tool is closed.

3

u/YoRt3m 2d ago

I run it directly on my machine and I know it's bad, but I'm not so worried. at most it will lock me out of my computer and ask for ransom.

1

u/banter_droid 2d ago

And exfiltrate your nudes

4

u/YoRt3m 2d ago

It will send it to all my contacts and it will be a free marketing tool for my Onlyfans.

1

u/tsangberg 2d ago

Made my own podman container based sandboxing with it's own MCP-based tools. Opencode, llm engine etc all still run on the host, but the agent's tools run inside a container which only has a strict subset mapped into it.

Open sourced under creative commons zero license, maybe something useful (it has a few more interesting features like remoting into other systems etc while still sandboxed): https://git.sync.wtf/troed/umwelt

1

u/s-i-e-v-e 2d ago

I built myself a sandbox called adamant and have been dogfooding it for the past three months.

Everyone should do the same. Easier alternative is to have the LLM produce a script that runs bubblewrap with minimal settings

1

u/jpero 1d ago

Docker Sandboxes (sbx)

1

u/psychowico 1d ago

I use Docker Sanboxes. it need some initial setup, then workflow is acceptable. but of course not so smooth like allowing it to work directly on your computer.

I see it working as I already catched the agent few times when it tried to go "outside" it allowed disc space etc. (giving stupid excuses after blocked and catched ;) )

1

u/Imaginary-Marketing3 1d ago

Built a cheap PC for mine. Works great.

1

u/Future_AGI 1d ago

building on u/CycleTourist1979's separate account, give that user a deploy key for the one repo instead of your own GitHub login. Then a run that goes sideways can at worst push to that repo, and branch protection on main keeps even that off your real history.