You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/DECISIONS.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -190,3 +190,15 @@ When a decision is superseded or obsolete, delete it (git history preserves the
190
190
- Deny `git remote add`, `set-url`, `remove`, `rename`, `set-head` in settings.json and all tier files -- read-only `git remote -v` remains allowed via the existing `Bash(git remote *)` allow rule
191
191
- Deny rules are absolute in Claude Code (cannot be overridden by allow), making this the correct control layer vs hooks
192
192
- Tier files use wildcard prefix `Bash(*git remote add *)` to catch chained command variants
193
+
194
+
## 2026-03-16: WebFetch Firewall Integration
195
+
196
+
**Request**: Connect the devcontainer iptables firewall to Claude Code's WebFetch permission settings so users don't need to manually edit the firewall script when working with external services.
197
+
198
+
**Decisions**:
199
+
- Firewall reads `WebFetch(domain:...)` patterns from settings.json and settings.local.json at container startup -- single source of truth for domain whitelisting
200
+
- Only `allow` and `ask` lists are scanned (not `deny`) -- denied domains should never be whitelisted
201
+
- Bare `WebFetch` (no domain qualifier) is ignored -- it grants tool permission but has no domain to resolve
202
+
- Wildcard domains (e.g., `*.example.com`) are skipped with a warning -- DNS cannot resolve wildcard patterns to IPs
203
+
- Empty domain values filtered by `sed '/^$/d'` instead of `grep -v '^$'` -- grep exits non-zero on empty input under `set -euo pipefail`
204
+
- WebFetch settings changes take effect on container restart (`init-firewall.sh` runs from `postStartCommand`); permission tier changes require rebuild (`onCreateCommand` copies tier to `settings.local.json`)
|`git remote add/set-url/remove/rename/set-head`| Ask the user to manage remotes | Prevents code exfiltration to unauthorized remotes |
49
49
50
+
## Firewall Configuration
51
+
52
+
The devcontainer firewall (`init-firewall.sh`) restricts all outbound traffic to a built-in allowlist plus domains from Claude Code permission settings.
53
+
54
+
**Built-in domains** (always allowed): PyPI, GitHub (via API CIDR ranges), Anthropic/Claude, VS Code Marketplace, uv/Astral, plus telemetry endpoints (`sentry.io`, `statsig.anthropic.com`, `statsig.com`).
55
+
56
+
**WebFetch domain auto-whitelisting**: The firewall scans `.claude/settings.json` and `.claude/settings.local.json` for `WebFetch(domain:...)` patterns in `allow` and `ask` lists. Matched domains are resolved via DNS and added to the ipset allowlist.
57
+
58
+
| Pattern | Firewall behavior |
59
+
|---------|-------------------|
60
+
|`WebFetch(domain:algoenergy.cz)`| Resolved and whitelisted |
61
+
|`WebFetch(domain:*.example.com)`| Skipped (wildcards cannot be resolved) |
62
+
|`WebFetch` (bare) | Ignored (no domain to resolve) |
63
+
|`WebFetch(domain:)` (empty) | Filtered out |
64
+
65
+
Changes to WebFetch settings in `.claude/settings.json` or `.claude/settings.local.json` take effect on container restart. Changes to `.devcontainer/permissions/*.json` require a full rebuild (`devcontainer rebuild`).
0 commit comments