WIP: feat(server): internal-only listener and per-bot browser home/namespace #14

Draft
Grok wants to merge 1 commit from bot-vm0/internal-listener into main
Contributor

Lets a deployment that gives every bot its own Linux user wall bots off from the owner API with per-uid firewall rules without cutting the engine-side proxies off from /api/internal/. OMB_INTERNAL_PORT opens a second loopback listener serving only /api/internal/ (404 for everything else) and points the engine-side proxies at it; off by default. OMB_BROWSER_HOME / OMB_BROWSER_NAMESPACE move a bot's browser state out of the server's home. 6 targeted tests pass (vitest). Needed by the bot-vm0 deployment (bitpartner/nixos-llm#799).

🤖 Generated with Claude Code

Lets a deployment that gives every bot its own Linux user wall bots off from the owner API with per-uid firewall rules without cutting the engine-side proxies off from /api/internal/*. OMB_INTERNAL_PORT opens a second loopback listener serving only /api/internal/* (404 for everything else) and points the engine-side proxies at it; off by default. OMB_BROWSER_HOME / OMB_BROWSER_NAMESPACE move a bot's browser state out of the server's home. 6 targeted tests pass (vitest). Needed by the bot-vm0 deployment (bitpartner/nixos-llm#799). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(server): an internal-only listener so bots can be walled off from the owner API
Some checks failed
contributors / CLA for enterprise/ changes (pull_request_target) Has been cancelled
CI / typecheck + lint (pull_request) Has been cancelled
CI / vitest (macos-latest, shard 1/4) (pull_request) Has been cancelled
CI / vitest (macos-latest, shard 2/4) (pull_request) Has been cancelled
CI / vitest (macos-latest, shard 3/4) (pull_request) Has been cancelled
CI / vitest (macos-latest, shard 4/4) (pull_request) Has been cancelled
CI / vitest (ubuntu-latest, shard 1/4) (pull_request) Has been cancelled
CI / vitest (ubuntu-latest, shard 2/4) (pull_request) Has been cancelled
CI / vitest (ubuntu-latest, shard 3/4) (pull_request) Has been cancelled
CI / vitest (ubuntu-latest, shard 4/4) (pull_request) Has been cancelled
CI / vitest (windows-latest, shard 1/4) (pull_request) Has been cancelled
CI / vitest (windows-latest, shard 2/4) (pull_request) Has been cancelled
CI / vitest (windows-latest, shard 3/4) (pull_request) Has been cancelled
CI / vitest (windows-latest, shard 4/4) (pull_request) Has been cancelled
CI / packaged server smoke (macos-latest) (pull_request) Has been cancelled
CI / packaged server smoke (ubuntu-latest) (pull_request) Has been cancelled
CI / packaged server smoke (windows-latest) (pull_request) Has been cancelled
CI / Windows CUA host smoke (pull_request) Has been cancelled
CI / Electron smokes (macOS) (pull_request) Has been cancelled
CI / typecheck + test (macos-latest) (pull_request) Has been cancelled
CI / typecheck + test (ubuntu-latest) (pull_request) Has been cancelled
CI / typecheck + test (windows-latest) (pull_request) Has been cancelled
CI / cloudflared installer (Linux ARM64) (pull_request) Has been cancelled
CI / open-source edition builds without enterprise/ (pull_request) Has been cancelled
CI / control-plane check + workerd tests + dry run (pull_request) Has been cancelled
CI / renderer smoke (control-omb ui, Ubuntu 24.04) (pull_request) Has been cancelled
CI / package + smoke (Ubuntu 24.04 x64) (pull_request) Has been cancelled
CI / Swift tests + iOS build + thread UI (pull_request) Has been cancelled
CI / Kotlin tests + Android build (pull_request) Has been cancelled
fb080656dd
A deployment that gives every bot its own Linux user can reject the owner
API's port for that uid with nftables. But the engine-side proxies — the
browser, phone, agents and connector bridges — run as the bot's uid too, and
they still need the bot capability routes under /api/internal/*. Blocking the
owner API would have cut their tools off from the routes they exist to reach.

OMB_INTERNAL_PORT opens a second loopback listener that serves exactly those
routes and answers 404 to everything else, and the engine-side proxies are
then given its address instead of the owner API's. The routes behind it are
the same routes with the same per-turn capability check: a second door to
them, not a weaker copy of them. It is off unless the variable is set, so a
server without it keeps every address and every behaviour it had, and a
value that is not a port is refused at start-up rather than silently
ignored.

OMB_BROWSER_HOME and OMB_BROWSER_NAMESPACE move a bot's browser out of the
server's own home, so a bot's user need not read the server user's files.
The namespace is lowercase-only, like agent-browser's own rule, and an
invalid one is refused at start-up rather than mid-turn.
Some checks failed
contributors / CLA for enterprise/ changes (pull_request_target) Has been cancelled
CI / typecheck + lint (pull_request) Has been cancelled
CI / vitest (macos-latest, shard 1/4) (pull_request) Has been cancelled
CI / vitest (macos-latest, shard 2/4) (pull_request) Has been cancelled
CI / vitest (macos-latest, shard 3/4) (pull_request) Has been cancelled
CI / vitest (macos-latest, shard 4/4) (pull_request) Has been cancelled
CI / vitest (ubuntu-latest, shard 1/4) (pull_request) Has been cancelled
CI / vitest (ubuntu-latest, shard 2/4) (pull_request) Has been cancelled
CI / vitest (ubuntu-latest, shard 3/4) (pull_request) Has been cancelled
CI / vitest (ubuntu-latest, shard 4/4) (pull_request) Has been cancelled
CI / vitest (windows-latest, shard 1/4) (pull_request) Has been cancelled
CI / vitest (windows-latest, shard 2/4) (pull_request) Has been cancelled
CI / vitest (windows-latest, shard 3/4) (pull_request) Has been cancelled
CI / vitest (windows-latest, shard 4/4) (pull_request) Has been cancelled
CI / packaged server smoke (macos-latest) (pull_request) Has been cancelled
CI / packaged server smoke (ubuntu-latest) (pull_request) Has been cancelled
CI / packaged server smoke (windows-latest) (pull_request) Has been cancelled
CI / Windows CUA host smoke (pull_request) Has been cancelled
CI / Electron smokes (macOS) (pull_request) Has been cancelled
CI / typecheck + test (macos-latest) (pull_request) Has been cancelled
CI / typecheck + test (ubuntu-latest) (pull_request) Has been cancelled
CI / typecheck + test (windows-latest) (pull_request) Has been cancelled
CI / cloudflared installer (Linux ARM64) (pull_request) Has been cancelled
CI / open-source edition builds without enterprise/ (pull_request) Has been cancelled
CI / control-plane check + workerd tests + dry run (pull_request) Has been cancelled
CI / renderer smoke (control-omb ui, Ubuntu 24.04) (pull_request) Has been cancelled
CI / package + smoke (Ubuntu 24.04 x64) (pull_request) Has been cancelled
CI / Swift tests + iOS build + thread UI (pull_request) Has been cancelled
CI / Kotlin tests + Android build (pull_request) Has been cancelled
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin bot-vm0/internal-listener:bot-vm0/internal-listener
git switch bot-vm0/internal-listener

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff bot-vm0/internal-listener
git switch bot-vm0/internal-listener
git rebase main
git switch main
git merge --ff-only bot-vm0/internal-listener
git switch bot-vm0/internal-listener
git rebase main
git switch main
git merge --no-ff bot-vm0/internal-listener
git switch main
git merge --squash bot-vm0/internal-listener
git switch main
git merge --ff-only bot-vm0/internal-listener
git switch main
git merge bot-vm0/internal-listener
git push origin main
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
donach/openmausbot!14
No description provided.