Skip to content

Wire capability-gated broker mediation into the process backend#277

Merged
seanwevans merged 1 commit into
mainfrom
claude/process-backend-broker
Jul 21, 2026
Merged

Wire capability-gated broker mediation into the process backend#277
seanwevans merged 1 commit into
mainfrom
claude/process-backend-broker

Conversation

@seanwevans

Copy link
Copy Markdown
Owner

Summary

The threat model lists "broker-mediated privileged operations" as a defended layer for backend="process", but the implementation didn't match: child.py's request() denied every call with a flat "not available for the process backend" error, and capabilities were dropped entirely on the way to the process backend. So a process-backend guest had no path to mediated privileged operations at all.

This reconciles reality with the model by mirroring the sub-interpreter backend's semantics.

Changes

  • child.pyrequest(capability, action, payload) is now gated on the granted capability names. An ungranted capability raises PolicyError at the boundary; a granted one is framed to the supervisor as an "ev": "request" message. The guest never performs the privileged action itself.
  • process_backend.py — the granted capability names are sent in the bootstrap frame, and an incoming request frame is surfaced via recv() as a BrokerRequest — the same object the sub-interpreter backend emits — so the supervisor mediates the action. Only capability names cross the boundary, never secret material.
  • supervisor.py — threads capabilities through spawn_spawn_processProcessSandbox (previously dropped for this backend).

Semantics (matches the thread backend)

Guest call Granted? Result
request("network", "connect", {...}) yes host receives BrokerRequest(capability="network", action="connect", payload={...}) via recv()
request("secret", "read", {}) no PolicyError raised at the boundary

Docs & tests

SECURITY.md (§3.1) and the threat model are updated; the threat model's history notes this makes the broker-mediation layer real for the process backend. New tests cover the granted path (payload round-trips as a BrokerRequest), the ungranted-with-no-capabilities path, and the ungranted-but-other-capabilities-present path.

Full suite: 494 passed, 6 skipped. black/isort/flake8/mypy clean; pylint 9.16 (gate 8.0).

🤖 Generated with Claude Code


Generated by Claude Code

The process backend denied every guest `request(...)` call with a flat
"not available for the process backend" error, so a process-backend guest had no
path to mediated privileged operations -- even though the threat model lists
"broker-mediated privileged operations" as a defended layer for that mode.

Mirror the sub-interpreter backend's semantics:

- child.py: `request(capability, action, payload)` is gated on the granted
  capability names. An ungranted capability raises PolicyError at the boundary;
  a granted one is framed to the supervisor as an "ev": "request" message. The
  guest never performs the privileged action itself.
- process_backend.py: the granted capability names are sent in the bootstrap
  frame, and an incoming request frame is surfaced via recv() as a BrokerRequest
  -- the same object the sub-interpreter backend emits -- so the supervisor
  mediates the action. Only capability names cross the boundary, never secrets.
- supervisor.py: thread `capabilities` through spawn -> _spawn_process ->
  ProcessSandbox (previously dropped for this backend).

SECURITY.md and the threat model are updated; the latter's history notes this
makes the broker-mediation layer real for the process backend.

Full suite: 494 passed, 6 skipped. black/isort/flake8/mypy clean; pylint 9.16.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PbbJc7Ntj159D9LNGevwC2
@seanwevans
seanwevans merged commit d7c798e into main Jul 21, 2026
18 checks passed
@seanwevans
seanwevans deleted the claude/process-backend-broker branch July 21, 2026 18:00
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.

2 participants