Skip to content

feat(jail): operator read-only and writable bind allowlists - #188

Open
drewstone wants to merge 1 commit into
mainfrom
feat/jail-path-allowlists
Open

feat(jail): operator read-only and writable bind allowlists#188
drewstone wants to merge 1 commit into
mainfrom
feat/jail-path-allowlists

Conversation

@drewstone

Copy link
Copy Markdown
Owner

What

BRIDGE_JAIL_RO_PATHS / BRIDGE_JAIL_RW_PATHS: operator allowlists of extra binds for every jailed worker (comma- or colon-separated absolute paths). Read-only extras apply under fs-jail; writable extras under both jail modes.

Why

An fs-jail hides the operator home by design. That also hides a harness whose install or state lives there: a Python venv (hermes, plus its uv-managed interpreter under ~/.local/share/uv), an isolated node prefix (prime-agent), an agent's own config dir. The discovery-lab bridge env already set BRIDGE_JAIL_RO_PATHS for opencode; no code read it. This makes the name real.

Safety

  • Parsed at boot: a relative path, /, /home, or the operator home itself refuses the bridge.
  • Per request: a bind at or above the working directory is refused (it would re-open sibling run scratch dirs).
  • Read-only extras with a non-fs-jail floor are a boot warning, not a refusal.
  • Writable extras are bound BEFORE read-only extras, so RW=$HOME/.hermes + RO=$HOME/.hermes/hermes-agent keeps an agent's state writable and its code read-only. The old order would have made the code writable.

Verification

  • tsc --noEmit exit 0; vitest run tests/jail.test.ts tests/jail-path-allowlists.test.ts 60/60; pre-push trace-contract-tests 44/44.
  • Live: a third discovery-lab bridge on :8901 booted on this branch with BRIDGE_JAIL_RW_PATHS=$HOME/.hermes and BRIDGE_JAIL_RO_PATHS=$HOME/.hermes/hermes-agent,$HOME/.local/share/uv,$HOME/bin,$HOME/.cache/cli-bridge/prime-agent,$HOME/.local/bin. Before: bwrap: execvp .../hermes: No such file or directory, same for prime-agent. After: hermes acp completes a jailed session end to end (HTTP 200) and prime-agent 0.7.0 (built from the pinned commit) is found and runs. Their remaining failures (hermes does not see HERMES_HOME inside the jail; prime's daemon backstop throws) are backend env-passthrough questions, tracked separately.

BRIDGE_JAIL_RO_PATHS and BRIDGE_JAIL_RW_PATHS add operator binds to every
jailed worker. An fs-jail hides the operator home by design, which also hides a
harness whose install or state lives there: a Python venv (hermes), an isolated
node prefix (prime-agent), an agent's own config dir. The lab's bridge env
already named BRIDGE_JAIL_RO_PATHS; no code read it.

Both lists are parsed at boot. A relative path, /, /home, or the home itself
refuses the bridge. A bind at or above a request's working directory refuses
that request. Read-only extras are inert unless the floor is fs-jail (boot
warning). Writable extras are bound before read-only ones so an operator can
keep an agent's state writable and carve its code back to read-only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant