-
Notifications
You must be signed in to change notification settings - Fork 35
Integrate AWF for Claude engine #6905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@copilot merge main |
|
@copilot reduce the mounts to only |
cff0dc0 to
9681818
Compare
|
🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰 |
|
💫 TO BE CONTINUED... Smoke Claude failed! Our hero faces unexpected challenges... |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
🤖 DIAGNOSTIC COMPLETE: Smoke Copilot No Firewall STATUS: ALL_UNITS_OPERATIONAL. MISSION_SUCCESS. |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
🎉 Yo ho ho! Smoke Copilot Safe Inputs found the treasure and completed successfully! ⚓💰 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
All Claude engine workflows now use minimal AWF mounts:
- /tmp:/tmp:rw
- ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE}:rw
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Mount only essential components for Claude CLI: - /usr/local/bin/node (Node.js runtime) - /usr/local/bin/claude (Claude CLI executable) - /usr/local/lib/node_modules/@Anthropic-AI (Claude package only, not all node_modules) This surgical approach provides Claude CLI functionality while minimizing the attack surface compared to mounting all of node_modules, npm, npx, and npm cache. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Instead of mounting /usr/local/bin/claude (which doesn't exist in GitHub Actions), invoke Claude directly: node /usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js Minimal mounts now: - /usr/local/bin/node (Node.js runtime) - /usr/local/lib/node_modules/@Anthropic-AI (Claude package directory) This approach works regardless of where npm creates the claude binary symlink. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
GitHub Actions' setup-node installs to /opt/hostedtoolcache/node, not /usr/local. Mount this entire directory (read-only) to give AWF container access to: - Node.js runtime - npm and npx - All globally installed packages (including Claude CLI) This pragmatic approach avoids path guessing while keeping the mount read-only. AWF's security value comes from network isolation, not filesystem isolation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Prepend hostedtoolcache node bin directory to PATH before invoking Claude. This ensures the claude command is found inside the AWF container even though GitHub Actions installs it in a non-standard location. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Replace PATH manipulation with npx invocation: - npx --yes @anthropic-ai/claude-code (explicit, clean) - No shell command substitution needed - No PATH exports - More maintainable and explicit about what we're running Mount remains the same (/opt/hostedtoolcache/node) but command is cleaner. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Use the configured Claude version (defaults to 2.0.71) in npx command: - npx --yes @anthropic-ai/[email protected] - Ensures version used matches installed version - Improves security and reproducibility - Version controlled by constants.DefaultClaudeCodeVersion 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
The claudeVersion variable needs to be defined in GetExecutionSteps function, not just GetInstallationSteps. This ensures npx invocation uses the correct pinned version (2.0.71 by default, or custom if configured). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
npx breaks MCP server launching (serena fails to connect). Revert to PATH export approach which keeps environment complete: - export PATH="...hostedtoolcache/node/.../bin:$PATH" && claude - Ensures all npm/node binaries available for MCP server spawning - Mount: /opt/hostedtoolcache/node:ro (read-only, pragmatic) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Resolved merge conflicts: - pkg/workflow/compiler_yaml_main_job.go: Added both Claude and Codex firewall log collection steps - pkg/workflow/domains.go: Added ClaudeDefaultDomains alongside new CodexDefaultDomains and merged domain functions - pkg/workflow/domains_test.go: Added tests for both Claude and Codex domain functions - pkg/workflow/firewall.go: Updated comment to include all supported engines Co-authored-by: pelikhan <[email protected]>
b7e3d79 to
ae5f860
Compare
Remove duplicate TestCodexDefaultDomains and TestGetCodexAllowedDomains functions that were accidentally introduced during rebase conflict resolution. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
🤖 DIAGNOSTIC COMPLETE: Smoke Copilot No Firewall STATUS: ALL_UNITS_OPERATIONAL. MISSION_SUCCESS. |
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
🎉 Yo ho ho! Smoke Copilot Safe Inputs found the treasure and completed successfully! ⚓💰 |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰 |
|
✅ Firewall validation complete... Smoke Codex Firewall confirmed network sandboxing is operational. 🛡️ |
Smoke Test Results - Run 20382606336Recent PRs:
Test Results:
Available Tools: add_comment, add_labels, create_issue, missing_tool, noop Overall: PASS cc @Mossaka
|
Smoke Test Results - Copilot Engine (No Firewall)Last 2 Merged PRs:
Test Results:
Overall Status: PASS (4/5 tests successful - gh tool requires GITHUB_TOKEN which is expected limitation)
|
|
PRs: #6999 Fix create-agentic-workflow agent prompting patterns; #6996 Restructure campaign designer to match workflow designer two-mode pattern
|
Smoke Test ResultsGitHub MCP: ✅ (Last 2 merged PRs reviewed) Overall Status: PASS
|
Smoke Test ResultsPRs: [WIP] Update Codex CLI to v0.76.0, [WIP] Update outdated files generated by init command ✅ GitHub MCP - Retrieved 2 recent PRs Overall: PARTIAL PASS (5/6 tests passed)
|
|
Recent merged PRs: Fix create-agentic-workflow agent prompting patterns; Restructure campaign designer to match workflow designer two-mode pattern
|
AWF Integration for Claude Engine
This PR integrates Application-level Firewall (AWF) for the Claude engine following the Copilot pattern. Deprecates Python hooks entirely—AWF is now the sole network restriction mechanism for Claude.
Core Changes
domains.go): AddedClaudeDefaultDomainswith Anthropic services, GitHub, infrastructure (CRL/OCSP), package managers, Playwrightclaude_engine.go): SetsupportsFirewall: true, AWF wraps Claude CLI with--ttyflag, domain allowlist, required mountsfirewall.go): AddedenableFirewallByDefaultForClaude()mirroring Copilot behaviorcompiler_yaml_main_job.go): Added firewall log upload/parsing steps for ClaudeRemoved (deprecated)
engine_network_hooks.go— Python hook generationclaude_settings.go— Settings file generation for hooksAWF Command Structure
Behavior
network.firewall: trueis set (or enabled by default when network restrictions present)sandbox.agent: falseparse_firewall_logs.cjs(engine-agnostic)Merged with main
Resolved merge conflicts in multiple files to incorporate Codex AWF support alongside Claude AWF support:
pkg/workflow/compiler_yaml_main_job.go: Added both Claude and Codex firewall log collection stepspkg/workflow/domains.go: Added ClaudeDefaultDomains alongside CodexDefaultDomains and merged domain functionspkg/workflow/domains_test.go: Added tests for both Claude and Codex domain functionspkg/workflow/firewall.go: Updated comment to include all supported engines (copilot, claude, codex)Original prompt
Overview
Integrate Application-level Firewall (AWF) for the Claude engine following the Copilot pattern, providing network isolation for Claude Code CLI via domain allowlisting.
User decisions
Phase 1: Core AWF integration
1.1 Add Claude default domains
File:
/home/mossaka/developer/gh-aw-repos/gh-aw/pkg/workflow/domains.goAdd after
CopilotDefaultDomains:Add helper(s) (pattern: merge defaults +
NetworkPermissions, deterministic sort; optionally appendhost.docker.internalwhen safe-inputs enabled).1.2 Enable firewall support in the Claude engine
File:
/home/mossaka/developer/gh-aw-repos/gh-aw/pkg/workflow/claude_engine.goSet
supportsFirewall: trueinNewClaudeEngine().Phase 2: Installation steps + hook removal
2.1 Update installation steps
File:
.../claude_engine.goUse base install (secret validation + npm install for
@anthropic-ai/claude-code) and, when firewall enabled, append AWF installation step.Note: remove all Python hook install/config logic.
2.2 Remove hook-related files (cleanup commit after verification)
.../engine_network_hooks.go(delete).../claude_settings.go(delete)Phase 3: AWF-wrapped execution
File:
.../claude_engine.goIn
GetExecutionSteps():Build Claude command using
npx @anthropic-ai/claude-code@<version> ...If firewall enabled: wrap command with
awfusing:--tty(required)--allow-domains <GetClaudeAllowedDomains...()>/tmp,gh/yq/date, plusnode/npxand npm cache dirs needed for the preinstalled package--proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logsElse: run Claude directly (baseline / sandbox.agent: false)
Phase 4: Observability & log parsing
js/parse_firewall_logs.cjs(engine-agnostic).js/parse_claude_log.cjs.compiler_yaml_main_job.go, add Claude firewall log upload/parsing steps around the same places as Copilot.Phase 5: Testing
Add
.github/workflows/smoke-claude-firewall.mdwith firewall enabled and allowed network presets; validate:npxinside AWFUpdate
.github/workflows/smoke-claude.mdwithsandbox.agent: falsefor comparison.Phase 6: Default enablement
File:
/pkg/workflow/firewall.goEnsure Claude follows the same “enabled by default” logic as Copilot (e.g.,
copilot || claude).Critical files summary
Modify
pkg/workflow/domains.go(ClaudeDefaultDomains + merge helper)pkg/workflow/claude_engine.go(supportsFirewall, install, exec wrapper)pkg/workflow/compiler_yaml_main_job.go(log steps)pkg/workflow/firewall.go(default enablement, if needed)Create
.github/workflows/smoke-claude-firewall.mdDelete (post-verify)
pkg/workflow/engine_network_hooks.gopkg/workflow/claude_settings.go...
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.