Prompt rules are not a security boundary
To be useful on real tasks, an AI coding agent has to run commands, read repositories, and inspect issue descriptions, review comments, and failed CI logs without asking permission at every step. Once an agent reads untrusted text while holding execution tools, prompt instructions alone cannot guarantee safety.
Why untrusted text breaks prompt-only rules
An interactive coding assistant can pause before each shell command and wait for you to read it. A background agent working through a backlog task cannot. To diagnose a bug or repair a broken build, it has to ingest text written outside your codebase: tickets from an issue tracker, pull request threads, test fixtures, dependency output, and failed CI logs.
To the model, all of that input arrives as plain text alongside its system instructions. A pasted log snippet, an external reporter's ticket, or a string inside a test fixture can carry misleading or adversarial instructions that steer the agent toward running an unexpected command, reading environment variables, or calling an external endpoint.
Telling an agent in its prompt "do not push" or "do not call external APIs" is good hygiene – it keeps ordinary runs predictable and prevents accidental mistakes – not an enforcement boundary. A real security boundary lives outside the model's context window and holds even when the process ignores its instructions.
Isolating every run on your runner
In Mergehand, the web application coordinates work and approvals while a Docker runner on your own computer or server executes the agent. Safety starts by constraining where each run executes and what it can reach:
- Fresh container per run. Every run starts in a new Docker container that is removed when the run ends, leaving no state behind between runs.
- Unprivileged user without Docker. Inside the container, the agent runs as an unprivileged user without access to Docker and sees only the repositories and files of its project. Because the runner service itself uses the Docker socket to start containers – root-level access to its host – run it on a dedicated machine or virtual machine. The runner connects outbound to the server, with no inbound port opened.
- Outbound network allowlist. Outbound traffic from the run container is restricted to your code host and tracker, your AI provider, package registries, and addresses your project allows. If the firewall cannot be set up, the run does not start. Because IP-based filtering with open DNS is a strong barrier rather than an absolute guarantee, network rules are paired with strict credential separation.
Keeping write credentials out of the container
An agent exploring code needs to fetch branches and inspect history, not administer your repository. Inside a run, the agent gets only a read-only token for your code host.
Service write tokens for your code host and tracker stay on the Mergehand server, encrypted with AES-256-GCM in the database; the interface and logs display only the last four characters, and known tokens are masked in run output. Your AI sign-in or API key stays only on your runner, and the Mergehand server never receives your AI credentials. See the full breakdown on security and data.
Server-controlled writes and isolated pushes
Writing back to your services happens outside the agent container. Opening merge requests – or pull requests on GitHub, Bitbucket, and Forgejo – and posting private review drafts are done by the Mergehand server. Pushing a branch runs on your runner in a separate container without the agent, on the server's instruction, with fixed checks: the branch builds on what is already on the remote (except after a rebase), and commits carry your own name and email with no trace of the agent. If a check fails, nothing is sent and the task waits for you with the reason.
In the eight-step workflow, the first push comes only after your explicit approval. After that first push, routine follow-ups – fixing a failing CI pipeline, a rebase that does not change content, sending the branch to your dev or test branch, and a conflict resolved during a rebase once checks pass – go without another approval, still through server checks and the agent-free push container.
Prompts describe how a careful developer should behave. Containers, network limits, read-only tokens, and server-controlled pushes enforce what the process can actually do.