For teams that share one Claude Code or Codex bot: run the real CLIs on one server. Every tool call runs as the person who asked, so a prompt injection in one person's PDF can't use anyone else's access.
Live demo, AI on, no sign-up · Video (80 s) · Install · Threat model · Design write-up · AGPL-3.0, no CLA, self-hosting free, no seat limit
Tested as if the injection already won. On every merge that touches code, CI acts as a hijacked engine signed in as Alice, on amd64 and arm64 (last run):
| What the hijacked engine tries | Tries | Got through |
|---|---|---|
Read, list, grep, glob or write Bob's and Finance's files with path tricks: ../, %2f, look-alike letters, NFD, null bytes, symlinks, hard links, /proc/self/root (cases) |
1,186 | 0 |
| From inside the sandbox: a stolen turn token, the server API, cloud metadata, DNS, the database file, other chats (checks) | 53 checks | 0 (53 of 53 passed) |
- Claude Code's permission rules cover tools and paths, not people. On a shared server every allowed Bash, Read or Edit call runs as the server's OS account, whoever asked.
- Turning tools off takes more than a flag. Deny Bash alone and Claude Code turns Glob and Grep back on as default tools (
claude.ts:41-45). Codex's server-side model catalog gave the model an exec tool despite our feature flags. The model ranidand read a file outside the team folder (codex.ts:4-7). - So both CLIs run with their shell and file tools off and act only through Trina's tools on an MCP socket. A model proxy re-checks the tool names in every model request from either CLI, sub-agents included.
- The server, not the model, says who asked. Each answer runs in a fresh engine process with a random token the model never sees. The socket maps every call to the person using that token plus the kernel's peer credentials. No tool takes the asker as an argument, and one function decides every file access through the tools (the optional
box_shellgets sandbox mounts built from the same rules). - We don't try to detect prompt injection. It can misuse the asker's own access, but through Trina's tools it can't reach anyone else's. On Linux the engine also runs as its own account in bubblewrap, Landlock and seccomp and can reach only the model proxy.
Try it first: demo.trina.app, AI on, no sign-up, on your own copy of a made-up company. The CEO names a salary file in #Everyone. As Mina in Marketing, ask for it directly or hide the request in a pasted review. Either way, Mina's AI can't open the file, and the Leadership folder isn't in her file list. Click Switch person to become Daniel, the CEO, and the same question gets the salary bands.
Self-host with Docker (Linux, or a Mac with OrbStack):
git clone https://github.com/trina-app/trina-ax.git && cd trina-ax/docker
cp env.example .env && docker compose up -d --build
docker compose exec trina-ax trina-ax-setup-link # open the link and create the ownerDocker is newer and less tested than the Linux install. An Ubuntu 24.04 server needs one host setting first.
Linux server (the main install, and Docker and a Windows PC run the same sandbox): Debian 12/13 or Ubuntu 24.04, systemd with cgroup v2, amd64 or arm64, 4 GB RAM, 20 GB disk. Linux guide · Docker guide · Windows PC · Office Mac
The team connects one API key (Anthropic or OpenAI), and everyone asks with it, with token limits per person, group or team. Use a Claude or ChatGPT plan only where its terms allow team use.
Two comments in our code explain the deny list and the Codex lockdown.
// server/src/engine/claude.ts:41-45
* Claude Code's built-in tools that are denied outright (--disallowedTools), on top of --tools naming only WebSearch
* (and Agent). A deny rule holds in every permission mode and in every sub-agent; it is the second layer under the
* tool list, for whatever a Claude Code change, a definition's `tools` (Glob / Grep come back to a child that lists
* them and not Bash) or a fork would bring back. Glob and Grep must be here with Bash: denying Bash alone makes them
* default tools again. Every name exists in the pinned 2.1.305 (plan review, 2026-10-30); Agent(fork) is the fork.// server/src/engine/codex.ts:4-7
// - `--disable <feature>` did not remove tools in exec mode; `-c features.<name>=false` did
// - the server-side model catalog sets tool_mode "code_mode_only" + shell_type "unified_exec", which gives the
// model an exec tool regardless of features (it ran `id` and read a file outside the team folder) -> we pass
// a local catalog (model_catalog_json) with shell_type "disabled", node_repl disabled, no experimental tools.We found two more. Built-in plugins load even with --setting-sources '', so every known one is switched off by name, and a plugin that still loads stops the turn. And a sub-agent's tool list is decided inside Claude Code and visible nowhere else, which is why the model proxy checks every model request's tools by exact name.
The engine's MCP bridge reads the turn token from a file, deletes the file and sends the token as the first line on the tool socket. A small gate reads the connecting process's uid and session from the kernel. This is the whole check (turns.ts:146-157):
// server/src/turns.ts:146-157
async authenticate(token: unknown, peer: Peer, waitMs = 3000, seen?: (t: Turn) => void): Promise<Turn | string> {
if (typeof token !== 'string' || token.length < 20) return 'missing token'
const t = this.byHash.get(h(token))
if (!t || t.revoked) return 'unknown or expired token'
seen?.(t)
if (peer.uid !== this.agentUid) return `peer uid ${peer.uid} is not the engine account`
if (t.pgid === null) await new Promise<void>((res) => { t.waiters.push(res); setTimeout(res, waitMs) })
if (t.revoked) return 'turn ended'
if (t.pgid === null) return 'turn engine not started'
if (peer.sid !== t.pgid) return `peer process ${peer.pid} is not part of this turn's engine (session ${peer.sid} != ${t.pgid})`
return t
}Every later call on that connection runs as the person who started the turn. No tool input says who is calling. One function decides every file access through the tools (the optional box_shell gets sandbox mounts built from the same rules), and a path the person can't open returns "not found or no access", the same as one that doesn't exist, so the AI can't probe for hidden folders (authorize.ts:77-84, test).
The engine and everything the model writes are untrusted. The boundary is the tool socket. The engine can ask, and the server decides. Code links point to the exact lines at commit 72df64f762, and the Codex name check to 1bfab9d652.
| Attacker | What they could try | What stops it | Evidence |
|---|---|---|---|
| A prompt injection in a file, page or message the AI reads | Read another person's files with a Trina tool | Every call runs as the asker and goes through the one permission check | mcp/socket.ts:112, policy/authorize.ts:57 |
| Same | Use Bash, Read or a shell to go around the tools | Built-ins off by flags and settings. The model proxy refuses Claude and Codex requests with tool names outside the turn's set | engine/claude.ts:259, proxy/model-proxy.ts:155, proxy/codex-path.ts:130 |
| Same | Claim to be someone else in a tool call | No tool takes an identity. The person comes from the turn token | turns.ts:146 |
| Code running in a compromised engine (Linux) | Read the team folder, database, other chats | bwrap shows only this chat folder. The files belong to another account | sandbox_linux.go:297 |
| Same | Use a stolen turn token | Token is checked against the engine uid and the turn's process session | turns.ts:151 |
| Same | Reach the network, the server API or cloud metadata | nftables lets the engine uid reach only the model proxy port. Each turn has its own network namespace | firewall.go:112 |
CI runs a Linux attack suite (amd64 and arm64) that probes from inside a turn as the engine account, and a red run blocks the release. A fake engine makes the calls instead of Claude Code or Codex, so it shows what a hijacked model can reach, not how often a model gets hijacked. Run the path fuzzer yourself: bun install --frozen-lockfile && bash native/build.sh && bun run test:fuzz:fast (1,168 calls on macOS, which skips the case-sensitive cases). The full write-up covers the process model, the token, the path checks and the sandbox, with every claim linked to code.
- The engine account and the bubblewrap, Landlock and seccomp sandbox are Linux-only (Docker and a Windows PC's WSL2 included). An office Mac runs the engine as the logged-in user, in a macOS sandbox profile.
- Whoever runs the server can read stored files and chats. On teams Trina hosts, that includes Trina's operators.
- Self-hosting is not offline: what a request needs goes to the AI provider you connect. The server also asks
updates.trina.appfor its own public address every 30 minutes (MYCEL_EXIT_ADDRESS_CHECK=offturns that off). - On fresh Trina teams, one company connection can serve the whole team by default. This software setting does not grant permission under Anthropic's or OpenAI's terms. Connection details
- The checks decide what may be read and saved where. They do not filter what the model writes in its answer.
- Trina AX has no security certification and is in heavy development.
- One team drive. Company-wide, group, project and personal folders, shared like Google Drive. Everyone's AI starts from the team's files and opens only what that person may open.
- Team skills. Write a
SKILL.md, or bring the skills in your.claudeor.codexfolder. A skill never gives extra access. - Pick up where a teammate left off. Open a teammate's AI session in a team project to see what they asked and how the AI did it, and keep going from there. Each new answer runs in your own engine session with your own access. Theirs is never resumed.
- Connected apps. Google, Slack, Notion, Linear, Figma, or any MCP server by its address.
- Every device. Browser, Mac, Windows, Linux, iPhone and Android.
AGPL-3.0-only: if you offer a modified version over a network, offer its source to those users. The cloud protocol is MIT (license). Notices · Third-party notices
Claude Code and Codex have their own terms. This project is not endorsed by Anthropic or OpenAI. Claude is a trademark of Anthropic.
Docs · Security · Contributing · Discord
