restrict container network egress to what the pipeline actually needs, not just github.com and the Anthropic API
Id: TD-PPagop-26082429 · Status: resolved · Filed: 2026-08-24 · Resolved: 2026-08-24 · Ref: #760 · Review: reviews/project-review-2026-08-23 R-01 F-SEC-01
Severity: Critical
Split out of TD-PPagop-26082407 (part 3 of its 3-part suggested fix) —
restricting container network egress, currently unbounded, per
reviews/project-review-2026-08-23/04-improvement-prompts.md’s prompt for
R-01 (“restrict container network egress to github.com (and its API
subdomains) and the Anthropic API — nothing else”). Landing this alongside
the prompt-framing change in TD-PPagop-26082407’s PR (#752) was judged too
risky without the investigation below; that PR lands the prompt-framing part
only.
Two findings from that investigation that whoever picks this up needs, neither obvious from the tech-debt record’s own one-line suggested fix:
-
The two-domain allowlist the suggested fix names would break real, already-relied-upon pipeline behaviour.
scripts/preview-deploy.sh(prompts/implementer.mdstep 4a,prompts/reviewer.md‘s equivalent step) fetchesapi.vercel.comand each pull request’s own dynamic*.vercel.apppreview URL — a hard requirement for poetic-fiddle, which deploys every PR to Vercel. Separately,prompts/implementer.mdandprompts/project-reviewer.mdboth namenpm install/npm cias an ordinary long-running command a stage waits out — the target repos’ own build/test tooling runs live, inside the stage, against whatever registry theirpackage.json/lockfile names (registry.npmjs.orgat minimum for a Next.js app; verify what each of the three target repos’ own toolchains actually needs — poetic-fiddle almost certainly, poetic and agent-ops themselves may differ). An allowlist of exactlygithub.comand the Anthropic API, taken literally, would silently break the Vercel preview check and anynpm install/npm cia stage runs — not a loud failure a node operator would immediately connect to the firewall change, but every affected stage quietly degrading (preview check reports “could not check”, or a dependency install hangs/fails) days or nodes apart. Enumerate the actual set — Vercel’s API and preview domains, whichever package registries each of the three repos’ own build/test/lint tooling reaches, anything else agh/git/claudeinvocation needs beyondgithub.comitself (e.g.*.githubusercontent.comfor raw content,api.github.com) — against all three target repos’ real toolchains before choosing a final allowlist, not just this repository’s own. -
The image runs fully non-root with no
NET_ADMIN, soiptables/nftinsideentrypoint.shis not available under the current privilege model, and neither package is even installed.deploy/docker/DockerfilesetsUSER agentbeforeENTRYPOINT, with nogosu/su-execstep to run any part of the container as root;deploy/docker/compose.yamlgrantscap_add: [NET_ADMIN, NET_RAW]only to thetailscalesidecar, never toscheduler/dashboard/dashboard-local. A firewall rule insideentrypoint.sh, as the tech-debt record’s own suggested fix names as one option, would need either installingiptables/nftablesand grantingNET_ADMINto every service that runs aclaudestage (a capability expansion of its own, worth weighing against what it buys), or an entrypoint restructure to run privileged setup as root before dropping toagent(gosu/su-exec, changing how every service starts). A Compose-only alternative that needs neither: putscheduler/dashboard/dashboard-localon aninternal: truenetwork with no route to the internet, and add a forward-proxy sidecar (the samenetwork_mode: service:<sidecar>pattern this file already uses fortailscale/dashboard) holding the only route out, running e.g.tinyproxy/squidwith a domain ACL — enforced by the network topology itself rather than by a mechanism running inside the image whose compromise is exactly what this record exists to contain. Whichever mechanism is chosen, verify it against a realdocker compose up(this repository’s own test suite runs outside a container per its header comment, perscripts/run-tests.sh, and cannot exercise this) — a misconfigured allowlist fails a node silently, node-by-node, with no test in this repository positioned to catch it before a human notices a cycle stopped producing PRs.
Suggested fix: enumerate the real domain set per finding 1 against all
three target repositories’ actual build/lint/test tooling (read each
repo’s own CI workflows for what they install/fetch, since that is the same
surface an unattended stage exercises locally); then implement via the
Compose-only internal-network-plus-egress-proxy design per finding 2 (no
image privilege change needed) unless investigation finds a reason to prefer
the NET_ADMIN-in-image alternative. Verify against a real docker compose up on at least one node before considering this closed — a static config
review is not enough for a control whose failure mode is silent.
Noticed while working PR #752.
Resolution (2026-08-24, #760)
Section titled “Resolution (2026-08-24, #760)”Landed as finding 2’s Compose-only design: the scheduler moved onto an
internal: true network (no gateway — enforcement by topology, outside the
fenced container), with an egress-proxy service — squid on the same
agent-ops image — holding the only route out, permitting CONNECT-to-443 on
deploy/docker/egress-allowlist.txt plus a node’s own EGRESS_EXTRA_ALLOW.
Finding 1 drove the allowlist’s enumeration, which then went further than
either of us: codeload.github.com (the tarball gatherers’ redirect
target), .githubusercontent.com (poetic-fiddle’s release-tarball root
dependency and ghcr blob redirects), fonts.googleapis.com/fonts.gstatic.com
(next/font/google fetches at build time), ghcr.io (lib/image-drift.sh
runs in the scheduler, not just watchtower). Claude Code’s optional traffic
is disabled in the scheduler’s environment rather than allowlisted.
test/egress-fence.test.sh pins the shape, the image build parses the squid
config, and scripts/doctor.sh’s Egress section probes the live fence’s
three failure shapes per node — the real-docker compose up verification
this record demanded ran on the operator workstation before landing (see
the PR). Residuals — the forge as an allowlisted exfiltration channel, DNS
resolution reaching the host resolver — are accepted and recorded under
D24, not pretended away.