Skip to content

docs(secure-agent-internals): note macOS chained-curl gap in The blind spot - #25

Merged
potiuk merged 1 commit into
mainfrom
docs/macos-chained-curl-gap
May 1, 2026
Merged

docs(secure-agent-internals): note macOS chained-curl gap in The blind spot#25
potiuk merged 1 commit into
mainfrom
docs/macos-chained-curl-gap

Conversation

@potiuk

@potiuk potiuk commented May 1, 2026

Copy link
Copy Markdown
Member

Summary

Verification surfaced a real gap that the existing ## The blind spot: Bash(curl *) and DNS-over-HTTPS section understates:

  • permissions.deny patterns match the first command of a Bash invocation only — chained calls (echo a; curl ...; echo b) slip past because the runtime sees echo a and lets the chain run.
  • On Linux, socat's SNI proxy closes the gap (network layer blocks the egress).
  • On macOS there is no socat. The framework currently uses Seatbelt only for filesystem isolation; Bash-subprocess network egress is unfiltered, so a chained curl reaches the network on macOS.

Adds a sub-section under "The blind spot" documenting the matching behaviour and the macOS-specific gap, plus three mitigations:

  1. Issue Bash calls one command at a time (the verify-secure-config skill already does this for its denial checks).
  2. Run an OS-level packet filter (pf on macOS, nftables on Linux) whitelisting the same hosts as sandbox.network.allowedDomains.
  3. Future framework enhancement: wrap macOS subprocesses in a sandbox-exec profile that restricts network* operations the way the current profile restricts file-read*. Open follow-up, not shipped today.

Test plan

  • prek run --files secure-agent-internals.md clean (markdownlint, typos, doctoc TOC regen).
  • New ### macOS: permissions.deny first-command-only matching H3 sub-section renders correctly under ## The blind spot.
  • No anchor links broken — the new sub-section's anchor (#macos-permissionsdeny-first-command-only-matching) appears in the regenerated TOC.

…d spot

Verification surfaced a real gap that the doc currently understates:

- `permissions.deny` patterns match against the *first* command of
  a Bash tool invocation, not against every command in a
  multi-command chain. A standalone `curl https://example.com` is
  correctly denied at the permission prompt; the same call buried
  mid-pipeline (`echo a; curl https://example.com; echo b`)
  starts as `echo a` and slips past the deny list.

- On Linux, that gap is closed by socat's SNI proxy: even when the
  runtime lets `curl` start, the network layer of the sandbox
  blocks the egress unless the destination host is on
  `sandbox.network.allowedDomains`.

- On macOS there is no socat. The framework's setup uses Seatbelt
  for filesystem isolation but does not currently wrap Bash-
  subprocess network egress on macOS, so a chained `curl` reaches
  the network on macOS even when the same call would be blocked
  on Linux.

Adds a sub-section to `## The blind spot: Bash(curl *) and
DNS-over-HTTPS` documenting the matching behaviour and the macOS-
specific gap. Lists three mitigations in increasing strength
(issue Bash calls one command at a time; run an OS-level packet
filter; future framework enhancement to wrap macOS subprocesses
in a network-restricting sandbox-exec profile).

Generated-by: Claude Code (Opus 4.7)
@potiuk
potiuk merged commit 925b4e3 into main May 1, 2026
7 checks passed
@potiuk
potiuk deleted the docs/macos-chained-curl-gap branch May 1, 2026 15:25
@andreahlert andreahlert added the mode:platform Substrate / infra — not a mode (sandbox, CI, validators) label May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mode:platform Substrate / infra — not a mode (sandbox, CI, validators)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants