Skip to content

Commit e2743d9

Browse files
eudelins-zamaenitratchilcano
authored andcommitted
ci(common): sandbox Claude Code behind Squid proxy + iptables (#2083)
* ci(common): sandbox Claude Code behind Squid proxy + iptables Run the claude-code-action inside a network sandbox to prevent data exfiltration to unauthorized hosts. Two layers of defense: - Squid proxy: L7 domain allowlist (.anthropic.com, .github.com, etc.) - iptables: blocks direct outbound TCP from the runner UID All dependencies (Bun, action node_modules, Claude Code CLI, OIDC token exchange) are pre-installed before lockdown because the action's internal installers use fetch() which ignores HTTP_PROXY. Also switches from --allowedTools to --dangerously-skip-permissions since the network sandbox handles security at the infrastructure level. update claude file with proper container setup fix: shellchecks fix zizmor warning ci(claude): rewrite workflow from template, address PR #1995 security review - Drop action wrapper, run claude CLI directly (avoids MCP stdin blocking) - Remove dead pull_request trigger - Separate GH_TOKEN from system prompt construction step - Tighten iptables: resolve Squid IP dynamically, block UDP/ICMP - Restrict squid allowlist to 3 domains (api.anthropic.com, platform.claude.com, github.com) - Cache Squid Docker image, add iptables save/restore cleanup - Add tracking comment for run visibility - Fix token revocation to use HTTPS_PROXY fix: replace A && B || C with proper if-then-else (SC2015) fix: capture error details instead of silent suppression OIDC exchange and token revocation now log the server response on failure instead of swallowing it with -sf/--silent/2>/dev/null. fix: shellcheck SC2001 and SC2015 in claude workflow Replace sed prompt extraction with parameter expansion (SC2001). chore: harden security practices chore: update claude action from secutiry * chore: rename claude.yml to claude-review.yml * chore: enforces changes in sandboxed claude-* workflow * ci(common): fix zizmor issues --------- Co-authored-by: enitrat <msaug@protonmail.com> Co-authored-by: Roger Carhuatocto <chilcano@intix.info>
1 parent b80867c commit e2743d9

File tree

4 files changed

+608
-164
lines changed

4 files changed

+608
-164
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ test-suite/gateway-stress/Dockerfile @zama-ai/fhevm-devs
1818

1919
# Coprocessor Team ownership
2020
/coprocessor/ @zama-ai/fhevm-coprocessor
21+
22+
# Enforces changes in Sandboxed AI CI/CD
23+
.github/squid/sandbox-*.conf @zama-ai/infosec
24+
.github/workflows/claude-*.yml @zama-ai/infosec
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Strict domain allowlist for CI sandbox
2+
# Only these domains are reachable through the Squid proxy.
3+
# Based on: https://github.com/zama-ai/security-hub/tree/main/docs/how-tos/sandboxed-claude-code
4+
#
5+
# To add a new domain: append ".example.com" to the acl below.
6+
# Leading dot means "this domain and all subdomains".
7+
8+
acl allowed_domains dstdomain \
9+
.api.anthropic.com \
10+
.platform.claude.com \
11+
.github.com
12+
13+
# Allow only explicitly allowed domains
14+
http_access deny !allowed_domains
15+
http_access allow allowed_domains
16+
17+
# Deny everything else
18+
http_access deny all

0 commit comments

Comments
 (0)