Skip to content
This repository was archived by the owner on Nov 9, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0496d08
Boat box backend behind Computer, CF Containers as fallback (BOX_BACK…
devin-ai-integration[bot] Oct 11, 2026
af34fce
boat: doc fixes
devin-ai-integration[bot] Oct 11, 2026
bb98a32
Take control: /takeover/:box mints a Boat desktop URL per request, we…
devin-ai-integration[bot] Oct 11, 2026
db13ca3
Browser calls wait up to 5 minutes for a human to hand the desktop ba…
devin-ai-integration[bot] Oct 11, 2026
b0ab1f8
Boat leak test, swap off in template, wait out Boat 429s, Chrome sess…
devin-ai-integration[bot] Oct 11, 2026
0739fb5
Boat: turn swap back off after resume (Boat recreates /swapfile); lea…
devin-ai-integration[bot] Oct 11, 2026
19fbed5
Take control: a browser call that waited on a human hold isn't run af…
devin-ai-integration[bot] Oct 11, 2026
e05a751
Boat: replay setup.sh on a new sandbox (first boot off Cloudflare), w…
devin-ai-integration[bot] Oct 11, 2026
6387b57
Vault fill/type only on the item's saved site (eTLD+1), red-team site…
devin-ai-integration[bot] Oct 11, 2026
15ed7ef
Box: reinstall browser deps when package-lock.json changes
devin-ai-integration[bot] Oct 11, 2026
25f0052
Red-team fake bw: swap in fake account values so real BW_* never reac…
devin-ai-integration[bot] Oct 11, 2026
6cbcb2b
Vault: accept the red-team fake bw only by its exact path, without re…
devin-ai-integration[bot] Oct 11, 2026
37c91c8
scan.mjs: take every BW_* var, so it also scans the red-team fake vault
devin-ai-integration[bot] Oct 11, 2026
1d3d4dc
Browser server: hash origin.mjs too, matching cli.mjs, so the server …
devin-ai-integration[bot] Oct 11, 2026
824abd7
scan.mjs: also grep the tmpfs browser log and volatile journald
devin-ai-integration[bot] Oct 11, 2026
56f94f8
Vault: run sync, list and get totp with the caller's env, so the fake…
devin-ai-integration[bot] Oct 11, 2026
e67362c
scan.mjs: pass needles on stdin as '-', since /dev/stdin can't be ope…
devin-ai-integration[bot] Oct 11, 2026
3aa7a40
boatd: send a space every 15 s on /exec, so Boat's proxy doesn't cut …
devin-ai-integration[bot] Oct 12, 2026
552dcdd
Red-team site: don't send the credential id (the passkey is discovera…
devin-ai-integration[bot] Oct 12, 2026
71e10b6
Red-team site: restore allowCredentials (the fake passkey is non-disc…
devin-ai-integration[bot] Oct 12, 2026
f868c31
scan.mjs: a file fails only if it holds a real needle, not just the c…
devin-ai-integration[bot] Oct 12, 2026
a845794
research/injection-redteam.md: red-team runs and evidence
devin-ai-integration[bot] Oct 12, 2026
0721b33
leaktest: upload browser/origin.mjs (server imports it since the vaul…
Oct 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/boat-leaktest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Zero-secrets-at-rest check on a real Boat sandbox (box/boat/leaktest.mts). Needs the repo secret BOAT_API_KEY; fails if it's missing.
name: boat-leaktest
on:
pull_request:
paths: ["box/boat/**", "browser/**", "src/core/boat.ts", "src/core/box.ts"]
workflow_dispatch:
jobs:
leaktest:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 22, cache: npm }
- run: npm ci --no-audit --no-fund
- run: test -n "$BOAT_API_KEY" || { echo "::error::The BOAT_API_KEY Actions secret is not set on this repo"; exit 1; }
env: { BOAT_API_KEY: "${{ secrets.BOAT_API_KEY }}" }
- run: npm run boat:leaktest
env: { BOAT_API_KEY: "${{ secrets.BOAT_API_KEY }}" }
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
.wrangler
.dev.vars
web/dist
__pycache__/
10 changes: 6 additions & 4 deletions BOX.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# Your box

`tools.bash` runs in your own Linux box (Debian, Node 22, git).
`tools.bash` runs in your own Linux box. It is a Boat VM (Ubuntu 24.04, Node 24, Chrome, a desktop, sudo) or a Cloudflare container (Debian, Node 22). The Cloudflare container is the default, and it is also the fallback when Boat is down. `[box: ...]` notes tell you when the box changed.

## What persists
- `/workspace` is a git repo (Artifacts repo `workspace`). Every change is committed and pushed after each bash call, so any version can be restored with git. Files over 10 MB are git-ignored automatically.
- The whole box (installed packages, caches, big files) is snapshotted when idle and restored on the next call.
- Snapshots can be lost (they expire after 30 days unused). Then the box starts fresh from git and runs `/workspace/setup.sh`.
- Boat: the disk persists across stops (`/home/user`, `/workspace`, and installs under `/usr`, `/etc` and `/opt`). `/workspace/setup.sh` runs only on a new sandbox, such as the first Boat boot of a box that was on Cloudflare. `~/.cache` and `/scratch` are not kept.
- Cloudflare: the whole box is snapshotted when idle and restored on the next call. Snapshots can be lost (they expire after 30 days unused). Then the box starts fresh from git and runs `/workspace/setup.sh`.

## Rules
- When you install something you want to keep, also append the command to `/workspace/setup.sh`.
- When you install something you want to keep, also append the command to `/workspace/setup.sh`. The Cloudflare fallback needs it.
- Never write secrets to disk. They come in each command's env.
- On Boat, vault values (passwords, TOTP, API keys) exist only at use time: in the browser's memory, in `vault run`'s child env, and Bitwarden's cache on tmpfs (`/dev/shm`). Never echo them into files, logs or scripts. Chrome's password manager and autofill are off, the journal is in memory, and shells keep no history. Logged-in browser state (cookies, local storage) does persist on the disk; `BOAT_WIPE_BROWSER_ON_STOP=1` deletes the Chrome profile before each stop.
- Put big throwaway files (downloads, intermediate data) in `/scratch`. It is never committed and is emptied when the box stops.
- Never change `box/Dockerfile`: a new image can't restore old snapshots. Install in the box instead.

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The design follows Victor Taelin's [OptChat](https://gist.github.com/VictorTaeli
- `prompts.ts`: the system and compactor prompts, plus the constants.
- `mcp.ts`, `oauth.ts`: the Executor client and its OAuth.
- `box.ts`: the `Computer` container (Durable Object scheduling policy, needed for snapshots) behind the `bash` tool. `/workspace` is a clone of the Artifacts repo `raubot/workspace`, auto-committed and pushed after every command (files over 10 MB are git-ignored). The whole container filesystem is also saved as a Container snapshot when idle for 10 minutes (and every 15 minutes while in use), so installs and big files persist. `/workspace/raubot` is a clone of this repo. The box rules (setup.sh, /scratch, self-deploy) live in `BOX.md`, which the prompt points raubot to.
- `boat.ts`: the Boat backend (`BOX_BACKEND=boat`, staging). Each box is a Boat VM whose disk persists. raubot's box starts from the named snapshot `BOAT_TEMPLATE`, which `box/boat/build.ts` builds from `box/boat/manifest.json` (packages, default-deny egress, the `boatd` daemon). Subagent boxes are forks of it. Computer agents run in raubot's own VM, so they share its disk and Chrome profile. The Worker sends commands, stdin and secrets to `boatd` over its private `host` URL, never through Boat's command API. Boxes are created with `noEnv` (no Boat account credentials) and `monitoring: false` (no command history), and git tokens come per command via `GIT_CONFIG_*`. If Boat fails, the box runs on the Cloudflare container for 10 minutes.
- `src/app/`: the web app, a client of `Core`. `index.ts` serves the chat, settings and tree pages, plus the `/ws` WebSocket that streams `CoreEvent`s.

## Source and deploys
Expand All @@ -36,5 +37,6 @@ npm install
echo "OPENAI_API_KEY=sk-..." > .dev.vars
npm run dev # http://localhost:8787
npm run deploy # raubot.reducto.ai, behind Cloudflare Access
npm run boat:template # needs BOAT_API_KEY in env; builds the Boat template and prints the name for BOAT_TEMPLATE
npm run deploy:staging # raubot-staging.reducto.ai: separate chat, box and Artifacts namespace `raubot-staging`; test here, not on the main instance
```
3 changes: 3 additions & 0 deletions box/boat/boatd.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// The Worker bundles boatd.mjs as text (wrangler.jsonc rules).
declare const source: string;
export default source;
66 changes: 66 additions & 0 deletions box/boat/boatd.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// raubot's box daemon on a Boat sandbox: runs commands for the Worker's Computer DO.
// Commands, stdin and their env (secrets) arrive in HTTPS request bodies, so they never become Boat command args or history.
// Exposed with `host 8912 --private`; each request also needs the token the Worker wrote to ~/.raubot/boatd.token.
import http from "node:http";
import fs from "node:fs";
import { spawn } from "node:child_process";

const PORT = 8912;
const MAX = 64 << 20;
const TOKEN = `${process.env.HOME}/.raubot/boatd.token`;

const token = () => { try { return fs.readFileSync(TOKEN, "utf8").trim(); } catch { return ""; } };

const body = (req) => new Promise((ok, fail) => {
const parts = [];
let n = 0;
req.on("data", (d) => { n += d.length; if (n > MAX) req.destroy(new Error("body too large")); else parts.push(d); });
req.on("end", () => ok(Buffer.concat(parts)));
req.on("error", fail);
});

/** `bash -lc cmd` in /workspace; stdout and stderr combined unless `split`. */
function run({ cmd, env = {}, stdin = "", stdin64, timeout = 120, split = false, cwd = "/workspace" }) {
return new Promise((ok) => {
const p = spawn("bash", ["-lc", split ? cmd : `exec 2>&1\n${cmd}`], { cwd, env: { ...process.env, ...env }, detached: true, stdio: ["pipe", "pipe", "pipe"] });
const out = [], err = [];
let timedOut = false;
const t = setTimeout(() => { timedOut = true; try { process.kill(-p.pid, "SIGKILL"); } catch {} }, timeout * 1000);
p.stdout.on("data", (d) => out.push(d));
p.stderr.on("data", (d) => err.push(d));
p.stdin.on("error", () => {});
p.stdin.end(stdin64 ? Buffer.from(stdin64, "base64") : stdin);
p.on("error", (e) => err.push(Buffer.from(String(e))));
p.on("close", (code, signal) => {
clearTimeout(t);
ok({ out: Buffer.concat(out).toString(), err: Buffer.concat(err).toString(), exitCode: code ?? (signal ? 128 : 1), timedOut });
});
});
}

http.createServer(async (req, res) => {
const json = (status, v) => { res.writeHead(status, { "content-type": "application/json" }); res.end(JSON.stringify(v)); };
try {
if (req.url === "/health") return json(200, { ok: true });
const want = token();
if (!want || req.headers["x-raubot-token"] !== want) return json(401, { error: "unauthorized" });
if (req.method === "POST" && req.url === "/exec") {
const job = run(JSON.parse((await body(req)).toString()));
// Boat's proxy drops a response with no bytes for 100 s (524), so long commands send a space every 15 s. JSON.parse skips them.
res.writeHead(200, { "content-type": "application/json" });
const beat = setInterval(() => res.write(" "), 15_000);
const r = await job;
clearInterval(beat);
return res.end(JSON.stringify(r));
}
if (req.url === "/screen") {
const r = await fetch("http://127.0.0.1:8913/screen").catch(() => undefined);
if (r?.status !== 200) return json(204, {});
res.writeHead(200, { "content-type": "image/jpeg", "x-url": r.headers.get("x-url") ?? "" });
return res.end(Buffer.from(await r.arrayBuffer()));
}
json(404, { error: "not found" });
} catch (e) {
json(500, { error: String(e) });
}
}).listen(PORT, "0.0.0.0");
41 changes: 41 additions & 0 deletions box/boat/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Builds the Boat template for fresh raubot boxes from manifest.json: a clean sandbox, install.sh, then a named snapshot.
// Usage: BOAT_API_KEY=... npx tsx box/boat/build.ts (prints the snapshot name for BOAT_TEMPLATE)
import fs from "node:fs";
import { createHash } from "node:crypto";
import { Boat } from "../../src/core/boat.ts";

const DIR = new URL(".", import.meta.url).pathname;
const FILES = ["manifest.json", "install.sh", "boatd.mjs", "firewall.sh", "raubot-boatd.service", "raubot-firewall.service"];

const key = process.env.BOAT_API_KEY;
if (!key) throw new Error("BOAT_API_KEY isn't set");
const boat = new Boat(key);
const hash = createHash("sha256");
for (const f of FILES) hash.update(f).update(fs.readFileSync(DIR + f));
const name = `raubot-box-${hash.digest("hex").slice(0, 10)}`;

const ready = async () => {
const s = await boat.snapshot(name);
const state = (s?.snapshot as { state?: string; status?: string } | undefined) ?? (s as { state?: string; status?: string } | undefined);
return state?.state ?? state?.status;
};

if ((await ready()) === "ready") { console.log(name); process.exit(0); }
const t = Date.now();
const id = await boat.create();
console.error(`builder ${id}`);
try {
await boat.ready(id);
for (const f of FILES) await boat.file(id, `.raubot-template/${f}`, fs.readFileSync(DIR + f, "utf8"));
const r = await boat.command(id, "sudo bash .raubot-template/install.sh", 600);
console.error(r.out.slice(-3000));
if (r.exitCode) throw new Error(`install.sh exited ${r.exitCode}`);
await boat.command(id, "rm -rf .raubot-template", 30);
await boat.saveSnapshot(id, name);
for (let s; (s = await ready()) !== "ready"; await new Promise((r) => setTimeout(r, 3000)))
if (s === "failed" || s === "error") throw new Error(`snapshot ${name} ${s}`);
console.error(`built ${name} in ${Math.round((Date.now() - t) / 1000)}s`);
console.log(name);
} finally {
await boat.remove(id).catch((e) => console.error(`couldn't delete builder ${id}: ${e}`));
}
39 changes: 39 additions & 0 deletions box/boat/firewall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
# Default-deny egress for the box, from manifest.json's "egress". Run as root at every boot (raubot-firewall.service):
# iptables rules don't survive a Boat stop/resume, which is a reboot.
set -euo pipefail
M=${1:-/opt/raubot/manifest.json}
tcp=$(jq -r '.egress.tcp | join(",")' "$M")
udp=$(jq -r '.egress.udp | join(",")' "$M")
deny=$(jq -r '.egress.deny[]' "$M")
# Boat's tunnel: WireGuard to the endpoint in wg0. Wait for it so the rule names the right address.
for i in $(seq 60); do WG=$(wg show wg0 endpoints 2>/dev/null | awk '{print $2}' | cut -d: -f1 | head -1); [ -n "$WG" ] && break; sleep 1; done
[ -n "${WG:-}" ] || { echo "no wg0 endpoint" >&2; exit 1; }
DNS=$(awk '/^nameserver/ && $2 !~ /:/ {print $2}' /etc/resolv.conf /run/systemd/resolve/resolv.conf 2>/dev/null | sort -u)

iptables -N RAUBOT-OUT 2>/dev/null || iptables -F RAUBOT-OUT
iptables -C OUTPUT -j RAUBOT-OUT 2>/dev/null || iptables -I OUTPUT 1 -j RAUBOT-OUT
A() { iptables -A RAUBOT-OUT "$@"; }
A -o lo -j ACCEPT
A -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
A -p udp -d "$WG" -j ACCEPT
A -o wg0 -j ACCEPT
A -p tcp --sport 8911 -j ACCEPT
for d in $DNS; do A -d "$d" -p udp --dport 53 -j ACCEPT; A -d "$d" -p tcp --dport 53 -j ACCEPT; done
for d in $deny; do A -d "$d" -j REJECT; done
A -p tcp -m multiport --dports "$tcp" -j ACCEPT
A -p udp -m multiport --dports "$udp" -j ACCEPT
A -j REJECT

ip6tables -N RAUBOT-OUT 2>/dev/null || ip6tables -F RAUBOT-OUT
ip6tables -C OUTPUT -j RAUBOT-OUT 2>/dev/null || ip6tables -I OUTPUT 1 -j RAUBOT-OUT
B() { ip6tables -A RAUBOT-OUT "$@"; }
B -o lo -j ACCEPT
B -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
B -o wg0 -j ACCEPT
B -p ipv6-icmp -j ACCEPT
B -p tcp --sport 8911 -j ACCEPT
B -p tcp -m multiport --dports "$tcp" -j ACCEPT
B -p udp -m multiport --dports "$udp" -j ACCEPT
B -j REJECT
echo "egress: tcp $tcp, udp $udp, wg $WG, dns ${DNS//$'\n'/ }"
37 changes: 37 additions & 0 deletions box/boat/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
# Run as root on a clean Boat sandbox by build.ts, with this directory copied to /home/user/.raubot-template.
set -euo pipefail
cd "$(dirname "$0")"
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq
command -v jq >/dev/null || apt-get install -y -qq jq >/dev/null
apt-get install -y -qq --no-install-recommends $(jq -r '.apt | join(" ")' manifest.json) >/dev/null
install -d /opt/raubot
install -m 0644 boatd.mjs manifest.json /opt/raubot/
install -m 0755 firewall.sh /opt/raubot/
install -m 0644 raubot-boatd.service raubot-firewall.service /etc/systemd/system/
# The box's commands run as `user`; browser/ links its `vault` CLI into /usr/local/bin.
chown user:user /usr/local/bin
# The browser uses the preinstalled Chrome on the real desktop, so Playwright's Chromium download is skipped.
install -d -o user -g user /home/user/.raubot /home/user/workspace
touch /home/user/.raubot/chromium && chown user:user /home/user/.raubot/chromium
# Nothing typed into a page is saved by Chrome: no password manager, no autofill.
for d in /etc/opt/chrome/policies/managed /etc/chromium/policies/managed; do
install -d "$d"
echo '{"PasswordManagerEnabled":false,"PasswordLeakDetectionEnabled":false,"AutofillAddressEnabled":false,"AutofillCreditCardEnabled":false}' > "$d/raubot.json"
done
# The journal stays in memory, and shells keep no history.
install -d /etc/systemd/journald.conf.d && printf '[Journal]\nStorage=volatile\n' > /etc/systemd/journald.conf.d/raubot.conf
systemctl restart systemd-journald && rm -rf /var/log/journal/*
# Boat ships a 2 GB /swapfile on the root disk; swapped-out memory (vault values, tmpfs pages) would land on disk.
swapoff -a; sed -i '/swapfile/d' /etc/fstab; systemctl mask swapfile.swap >/dev/null 2>&1; rm -f /swapfile
echo 'vm.swappiness=0' > /etc/sysctl.d/90-raubot-noswap.conf
grep -q 'HISTFILE=/dev/null' /etc/bash.bashrc || echo 'HISTFILE=/dev/null' >> /etc/bash.bashrc
git config --system user.name raubot && git config --system user.email raubot@reducto.ai && git config --system init.defaultBranch main
systemctl daemon-reload
systemctl enable --now raubot-firewall.service raubot-boatd.service
sleep 1
curl -fsS http://127.0.0.1:8912/health
curl -fsS -m 10 -o /dev/null -w 'egress https %{http_code}\n' https://github.com
! curl -fsS -m 5 -o /dev/null http://169.254.169.254/ 2>/dev/null || { echo "metadata reachable" >&2; exit 1; }
echo template ok
Loading
Loading