Repository navigation
fix(agent): put oracle's Alloy behind a Docker socket proxy, and check every docker run for the socket - #868
Conversation
…k every docker run for the socket oracle's Alloy is a `docker run` in deploy-agent.sh, not a compose service, so neither #193 nor #836's compose check reached it, and it kept /var/run/docker.sock mounted: root on the host, since `:ro` does not stop POST /containers/create. - deploy-agent.sh's Docker runtime starts alloy-socket-proxy beside Alloy on a private `alloy` network: the estate's image (image-for.sh docker-socket-proxy) and its GET-only allowlist. Alloy reads the API via DOCKER_API, and its socket mount is gone. - check_image_pins.py refuses a socket bind in any `docker run` in the repo except one running an image traced to the proxy service (five fixtures under --self-test). Its first run found exactly this site. - docs/security.md, add-monitored-device.md and the changelog say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The socket guard can be bypassed by placing the proxy image variable in a non-image argument.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds a Docker socket proxy for oracle’s Alloy agent and guards against unsafe socket mounts.
Changes:
- Runs Alloy and its proxy on a private Docker network.
- Adds repository-wide socket-mount validation and self-tests.
- Updates security, runbook, and changelog documentation.
| File | Description |
|---|---|
scripts/deploy-agent.sh |
Deploys the proxy and routes Alloy through it. |
scripts/check_image_pins.py |
Adds socket-bind validation and fixtures. |
docs/security.md |
Documents oracle’s proxy protection. |
docs/runbooks/add-monitored-device.md |
Updates deployment architecture. |
docs/changelog.md |
Records the security change. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…ay a docker run reaches the socket The review finding on #867 applies here: deploy-agent.sh gives Alloy -v /:/rootfs:ro, which carries /rootfs/run/docker.sock past the new proxy, because a read-only mount does not stop connect() and Alloy is the socket's owner. Alloy now gets --tmpfs /rootfs/run. check_image_pins.py's socket rule now matches check_compose_health.py's: the socket under either spelling, a mount of /run or /var/run, or the host's / without --tmpfs over <target>/run. Nine fixtures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Pushed the #867 review finding here too. 🤖 Generated with Claude Code |
…, not when its variable appears anywhere Review on #868: the exemption accepted a proxy-traced variable anywhere in the arguments, so `docker run -e "$PROXY_IMAGE" -v /var/run/docker.sock:... "$IMAGE"` passed while the collector held the socket. The rule now finds the image operand (the first positional, past flags and their values) and exempts only when that is the proxy. Unknown boolean flags misparse toward refusing, never toward allowing. Four new fixtures: three decoys, and the real proxy run from deploy-agent.sh flag for flag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…proxy # Conflicts: # docs/changelog.md

What changed
scripts/deploy-agent.sh's Docker runtime startsalloy-socket-proxybeside Alloy, on a privatealloynetwork.image-for.sh docker-socket-proxy, the estate's, and the allowlist is the estate's flag for flag:CONTAINERS,IMAGES,INFO,VERSION,EVENTSandNETWORKSare 1, andPOSTand everything else are 0.DOCKER_API=tcp://alloy-socket-proxy:2375and loses its socket mount.scripts/check_image_pins.pyrefuses a socket bind in anydocker runin the repository's scripts, Makefile, workflows or runbooks, unless that run's image is traced to the proxy service.--self-test, whichself-tests.shdiscovers.docs/security.md,add-monitored-device.mdand the changelog.Why
Found while fixing #836 (PR #867). #193 moved the estate's Alloy behind the proxy, and #836 moves the lab's three. oracle's Alloy is started by
deploy-agent.shas a singledocker run, outside any compose file, socheck_compose_health.pycould not see it. It kept/var/run/docker.sockmounted.:rodoes not stopPOST /containers/create, so that was root on oracle.Blast radius
oracle only, at its next
deploy-agent.sh --runtime dockerrun. Merging changes nothing that is running. Native hosts (Saruman, phoenix) take a different branch and are untouched.The failure to watch for is the one #193 measured: a too-narrow allowlist collects less without erroring. After the redeploy, check
loki_source_docker_target_entries_total{host="oracle"}.Expect a small conflict with #867 in the
docs/security.mdparagraph about who still holds the socket. Both PRs rewrite it; keep both halves.-p.secrets/*.sops.yamlVerification
check_image_pins.py --self-test: all 5 fixtures pass.check_image_pins.pyflagged exactly one site,deploy-agent.sh's Alloy run. After it: 52 invocations, all clean.check_docs.pyand markdownlint all pass.make validatepasses (CI)docker logs alloy-socket-proxyshows no 403s, and oracle's container logs still arrive in Loki.🤖 Generated with Claude Code