Skip to content

Consume the claude-sandbox devcontainer feature - #4

Draft
zlrth wants to merge 1 commit into
masterfrom
worktree-consume-claude-sandbox
Draft

Consume the claude-sandbox devcontainer feature#4
zlrth wants to merge 1 commit into
masterfrom
worktree-consume-claude-sandbox

Conversation

@zlrth

@zlrth zlrth commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Extracts the reusable parts of .devcontainer/ — Claude Code install, persistent auth/state, the default-deny egress firewall, scoped sudo — into a published devcontainer feature, ghcr.io/zlrth/devcontainer-features/claude-sandbox:1, and converts this repo into its first consumer. What remains here is only what is shen.clj's own: the JDK/Clojure image, the dev user, the cache-volume mount points, and the Maven/Clojars allowlist.

Behavior changes that came with the extraction:

  1. Default permission mode is now acceptEdits (seeded via settings.json), not bypass. bypassPermissions is a documented opt-in on the feature.
  2. Blanket NOPASSWD sudo grants from base images are removed at build time — without that, the agent could sudo iptables -F and the egress rules were decorative. (The old hand-rolled setup didn't have this hole because the clojure image has no sudoers entries, but the feature also targets the devcontainers/base images, which do.)
  3. Claude state lives in a feature-managed volume keyed by ${devcontainerId} instead of the hand-named shen-clj-claude-state. The old volume is orphaned; docker volume rm shen-clj-claude-state reclaims it.
  4. The firewall gained two fixes found while extracting: re-running it now resets policies before flushing (previously a re-run blackholed DNS and failed), and the negative verification canary skips hosts the caller allowlisted.

Verified from this branch: devcontainer up builds against the published feature; JDK 21 + Clojure 1.12.5 resolve the full :test dep tree through the firewall; clojars reachable, example.com blocked; workspace trusted; sudo scoped to init-firewall.sh alone.

🤖 Generated with Claude Code

The Claude-Code- and firewall-shaped parts of .devcontainer — the install,
CLAUDE_CONFIG_DIR and the seeded onboarding, init-firewall.sh, the scoped
sudoers entry, the NET_ADMIN/NET_RAW caps, the state volume — are now
ghcr.io/zlrth/devcontainer-features/claude-sandbox:1, extracted from this
repo and published from github.com/zlrth/devcontainer-features. What remains
here is only what is shen.clj's own: the JDK/Clojure image, the dev user,
the cache-volume mount points, and the Maven/Clojars allowlist.

Behavior changes that came with the extraction:

- The default permission mode is now acceptEdits (seeded via settings.json),
  not bypass; bypassPermissions is a documented opt-in on the feature.
- Blanket NOPASSWD sudo grants from the base image are removed at build
  time, so the agent cannot flush its own egress rules.
- Claude state lives in a feature-managed volume keyed by devcontainer
  rather than the hand-named shen-clj-claude-state.

Verified from this branch: devcontainer up builds against the published
feature; JDK 21 + Clojure 1.12.5 resolve the full :test dep tree through
the firewall; clojars reachable, example.com blocked; workspace trusted;
sudo scoped to init-firewall.sh alone.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant