Skip to content

Restricted network egress for agent containers via a per-run host proxy #2743

Closed

Description

@integry

Restricted network egress for agent containers via a per-run host proxy (no privileged containers)

Context

scripts/init-firewall.sh (an iptables allowlist for Anthropic and GitHub) ships in the agent image but is never executed: every entrypoint (scripts/claude-entrypoint.sh, codex-entrypoint.sh, opencode-entrypoint.sh, …) prints "Skipping firewall setup (would require --privileged Docker flag)". Containers run with --network bridge (packages/core/src/agents/impl/utils/dockerArgsBuilder.ts), so an agent has ordinary outbound access. The public FAQ describes the allowlist as optional and off by default; in practice operators cannot turn it on without privileged containers.

Requirements

  1. Per-run egress proxy on the host (worker) side: for a run with restricted networking, start a lightweight HTTP/HTTPS CONNECT proxy bound to the Docker bridge gateway (or a Unix socket forwarded into the container) that only allows connections to an allowlist of hostnames. DNS resolution happens in the proxy on the host; the container is started with --network none (or an internal network without external route) and HTTP_PROXY/HTTPS_PROXY/NO_PROXY pointing at the proxy. No --privileged, no --cap-add NET_ADMIN.
  2. Allowlist: a built-in base list per agent (the provider API hosts for Claude/Codex/Antigravity/OpenCode/Vibe, github.com, api.github.com, objects.githubusercontent.com, npm/pypi registries), plus repository additions in .propr/workflow.yml:
    network:
      mode: restricted      # open (default, current behaviour) | restricted
      allow:
        - "registry.npmjs.org"
        - "*.internal.example.com"
    and an instance-level default mode in settings (packages/core/src/config/configManager.ts), with the repository file able to tighten but not loosen below the instance policy when the instance sets restricted as mandatory.
  3. Agent compatibility: verify every supported agent honours the proxy env vars for its API traffic (Claude Code, Codex, Antigravity, OpenCode, Vibe) and that git inside the container uses it (https.proxy). Document any agent that does not, and for that agent fall back to open with a timeline warning rather than breaking the run.
  4. Observability: the proxy logs denied connection attempts (host, count) to the task timeline as a single aggregated event at the end of the run, and the task detail shows the mode and the denied-host summary. Denied hosts must never be silently dropped from the record.
  5. Lifecycle: the proxy lives and dies with the container; the reconciler/cleanup must kill orphaned proxies. Port allocation must not collide across concurrent runs on one worker.
  6. Remove the dead firewall script and the "Skipping firewall setup" lines, or keep the script only if it is wired to something real.

Documentation

  • docs/docs/features/execution-safety.md and docs/docs/concepts/security-overview.md: describe restricted mode accurately (what is and is not blocked, DNS behaviour, limitations).
  • docs/docs/features/repository-workflow.md: the network block.
  • Update the site/FAQ wording in a follow-up (out of scope here).
  • CHANGELOG.md Unreleased entry.

Tests

  • Proxy unit tests: allowed host → connect; denied host → 403 and recorded; wildcard matching; IP literals denied unless allowlisted.
  • Integration test (can be behind a Docker-available guard like the existing image smoke tests): a container in restricted mode can reach an allowed host via the proxy and cannot reach a denied one directly.
  • Workflow schema validation test for the network block.
  • Run npm run lint, npm run typecheck and the affected suites.

From the Warren comparison (2026-10-06); planned for batch 4. Batch 1 is #2734, #2735, #2736.

Activity

  1. added
    enhancement
    on Oct 5, 2026
  2. propr-dev commented on Oct 6, 2026

    @propr-dev
    Contributor

    🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: claude
    • Model: claude-opus-5-5
    • Branch: 2743/claude-opus-5-5-restricted-network-egress-20261006-2103-yel
    • Base Branch: main
    • Worktree: issue-2743-20261006-2103-claude-opus-5-5-yel

    🔍 Track Task Execution

  3. added a commit that references this issue on Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    AIAI-doneenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions