-
Notifications
You must be signed in to change notification settings - Fork 21
feat(cli): add --enable-chroot for transparent host binary execution #448
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
ae5ef67
feat(cli): add --enable-chroot for transparent host binary execution
Mossaka 0bb15c6
test(chroot): add integration tests for Python, Node, Go
Mossaka eb70f00
test(chroot): add package manager and edge case tests
Mossaka 4a1183d
fix(test): use 'localhost' instead of empty allowDomains array
Mossaka 84857de
test(docker-manager): add tests for getRealUserHome passwd lookup
Mossaka 5a2e2b5
fix(test): handle debug output in stdout for edge case tests
Mossaka 1586452
test(chroot): skip custom env var test in chroot mode (known limitation)
Mossaka 0ca6a44
docs(chroot): add documentation for --enable-chroot feature
Mossaka 371e80a
fix(security): restore DNS config on chroot exit and fix docs
Mossaka 323ec2c
feat(chroot): use minimal agent image without Node.js
Mossaka bb58040
feat: add smoke-chroot agentic workflow for --enable-chroot testing
Mossaka 4267e54
feat(smoke-chroot): add multi-runtime version verification
Mossaka 10a4d72
fix(smoke-chroot): run tests in setup step, agent reports results
Mossaka 868c4cf
fix(smoke-chroot): run agent inside chroot, let it test directly
Mossaka 6ff64fb
fix(workflow): correct chroot smoke test to run commands directly
Mossaka 6eea890
refactor(workflow): simplify chroot smoke test prompt
Mossaka e5ecbbc
chore(workflow): switch smoke-chroot to Copilot engine
Mossaka b6cff01
fix(security): remove host /proc mount from chroot mode
Mossaka da9726e
feat(smoke-chroot): add version verification between host and chroot
Mossaka 33ce8ae
fix(smoke-chroot): use remote gh-aw actions instead of local
Mossaka 706c711
fix(chroot): mount /proc/self for Go runtime support
Mossaka c98e360
fix(chroot): pass host PATH for consistent tool versions
Mossaka af10718
fix(chroot): pass GOROOT for GitHub Actions Go support
Mossaka 8a7cf2f
refactor(smoke-chroot): use chroot mode with simplified awf command
Mossaka 2eabf9b
revert(smoke-chroot): use standard awf mode until chroot is released
Mossaka 647a54a
fix(chroot): export GOROOT in workflow for Go tests
Mossaka d98aecd
fix(chroot): pass CARGO_HOME and JAVA_HOME for CI runners
Mossaka 339b515
fix(chroot): ensure CARGO_HOME and JAVA_HOME are preserved through sudo
Mossaka e85929b
fix(chroot): set LD_LIBRARY_PATH for Java shared libraries
Mossaka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,238 @@ | ||
| name: Chroot Integration Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| test-chroot-languages: | ||
| name: Test Chroot Language Support | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | ||
| with: | ||
| node-version: '22' | ||
| cache: 'npm' | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5 | ||
| with: | ||
| go-version: '1.22' | ||
|
|
||
| - name: Verify host tools are available | ||
| run: | | ||
| echo "=== Verifying host tools ===" | ||
| echo "Node.js: $(node --version)" | ||
| echo "npm: $(npm --version)" | ||
| echo "Python: $(python3 --version)" | ||
| echo "pip: $(pip3 --version)" | ||
| echo "Go: $(go version)" | ||
| echo "Git: $(git --version)" | ||
| echo "curl: $(curl --version | head -1)" | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Build project | ||
| run: npm run build | ||
|
|
||
| - name: Build local containers | ||
| run: | | ||
| echo "=== Building local containers ===" | ||
| docker build -t ghcr.io/githubnext/gh-aw-firewall/squid:latest containers/squid/ | ||
| docker build -t ghcr.io/githubnext/gh-aw-firewall/agent:latest containers/agent/ | ||
|
|
||
| - name: Pre-test cleanup | ||
| run: | | ||
| echo "=== Pre-test cleanup ===" | ||
| ./scripts/ci/cleanup.sh || true | ||
|
|
||
| - name: Run chroot language tests | ||
| run: | | ||
| echo "=== Running chroot language tests ===" | ||
| npm run test:integration -- --testPathPattern="chroot-languages" --verbose | ||
| env: | ||
| JEST_TIMEOUT: 180000 | ||
|
|
||
| - name: Post-test cleanup | ||
| if: always() | ||
| run: | | ||
| echo "=== Post-test cleanup ===" | ||
| ./scripts/ci/cleanup.sh || true | ||
|
|
||
| - name: Collect logs on failure | ||
| if: failure() | ||
| run: | | ||
| echo "=== Collecting failure logs ===" | ||
| docker ps -a || true | ||
| docker logs awf-squid 2>&1 || true | ||
| docker logs awf-agent 2>&1 || true | ||
| ls -la /tmp/awf-* 2>/dev/null || true | ||
| sudo cat /tmp/awf-*/squid-logs/access.log 2>/dev/null || true | ||
|
|
||
| test-chroot-package-managers: | ||
| name: Test Chroot Package Managers | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 45 | ||
| needs: test-chroot-languages # Run after language tests pass | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | ||
| with: | ||
| node-version: '22' | ||
| cache: 'npm' | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5 | ||
| with: | ||
| go-version: '1.22' | ||
|
|
||
| - name: Setup Ruby | ||
| uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1 | ||
| with: | ||
| ruby-version: '3.2' | ||
|
|
||
| - name: Setup Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - name: Setup Java | ||
| uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '21' | ||
|
|
||
| - name: Verify host tools are available | ||
| run: | | ||
| echo "=== Verifying host tools ===" | ||
| echo "Node.js: $(node --version)" | ||
| echo "npm: $(npm --version)" | ||
| echo "Python: $(python3 --version)" | ||
| echo "pip: $(pip3 --version)" | ||
| echo "Go: $(go version)" | ||
| echo "Ruby: $(ruby --version)" | ||
| echo "Gem: $(gem --version)" | ||
| echo "Rust: $(rustc --version)" | ||
| echo "Cargo: $(cargo --version)" | ||
| echo "Java: $(java --version 2>&1 | head -1)" | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Build project | ||
| run: npm run build | ||
|
|
||
| - name: Build local containers | ||
| run: | | ||
| echo "=== Building local containers ===" | ||
| docker build -t ghcr.io/githubnext/gh-aw-firewall/squid:latest containers/squid/ | ||
| docker build -t ghcr.io/githubnext/gh-aw-firewall/agent:latest containers/agent/ | ||
|
|
||
| - name: Pre-test cleanup | ||
| run: | | ||
| echo "=== Pre-test cleanup ===" | ||
| ./scripts/ci/cleanup.sh || true | ||
|
|
||
| - name: Run chroot package manager tests | ||
| run: | | ||
| echo "=== Running chroot package manager tests ===" | ||
| npm run test:integration -- --testPathPattern="chroot-package-managers" --verbose | ||
| env: | ||
| JEST_TIMEOUT: 300000 | ||
|
|
||
| - name: Post-test cleanup | ||
| if: always() | ||
| run: | | ||
| echo "=== Post-test cleanup ===" | ||
| ./scripts/ci/cleanup.sh || true | ||
|
|
||
| - name: Collect logs on failure | ||
| if: failure() | ||
| run: | | ||
| echo "=== Collecting failure logs ===" | ||
| docker ps -a || true | ||
| docker logs awf-squid 2>&1 || true | ||
| docker logs awf-agent 2>&1 || true | ||
| ls -la /tmp/awf-* 2>/dev/null || true | ||
| sudo cat /tmp/awf-*/squid-logs/access.log 2>/dev/null || true | ||
|
|
||
| test-chroot-edge-cases: | ||
| name: Test Chroot Edge Cases | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| needs: test-chroot-languages # Run after language tests pass | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | ||
| with: | ||
| node-version: '22' | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Build project | ||
| run: npm run build | ||
|
|
||
| - name: Build local containers | ||
| run: | | ||
| echo "=== Building local containers ===" | ||
| docker build -t ghcr.io/githubnext/gh-aw-firewall/squid:latest containers/squid/ | ||
| docker build -t ghcr.io/githubnext/gh-aw-firewall/agent:latest containers/agent/ | ||
|
|
||
| - name: Pre-test cleanup | ||
| run: | | ||
| echo "=== Pre-test cleanup ===" | ||
| ./scripts/ci/cleanup.sh || true | ||
|
|
||
| - name: Run chroot edge case tests | ||
| run: | | ||
| echo "=== Running chroot edge case tests ===" | ||
| npm run test:integration -- --testPathPattern="chroot-edge-cases" --verbose | ||
| env: | ||
| JEST_TIMEOUT: 180000 | ||
|
|
||
| - name: Post-test cleanup | ||
| if: always() | ||
| run: | | ||
| echo "=== Post-test cleanup ===" | ||
| ./scripts/ci/cleanup.sh || true | ||
|
|
||
| - name: Collect logs on failure | ||
| if: failure() | ||
| run: | | ||
| echo "=== Collecting failure logs ===" | ||
| docker ps -a || true | ||
| docker logs awf-squid 2>&1 || true | ||
| docker logs awf-agent 2>&1 || true | ||
| ls -la /tmp/awf-* 2>/dev/null || true | ||
| sudo cat /tmp/awf-*/squid-logs/access.log 2>/dev/null || true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium test