diff --git a/.github/agents/diagnose-awf.md b/.github/agents/diagnose-awf.md index d6fdddf30..661ff0609 100644 --- a/.github/agents/diagnose-awf.md +++ b/.github/agents/diagnose-awf.md @@ -150,6 +150,9 @@ Reuse these instead of duplicating their commands: | Smoke workflow exhausts its execution timeout during a cold local Docker image build | CI-008 | ci | fixed | | AWF invocation combines a compiler-pinned image manifest with --build-local | CI-008 | ci | fixed | | Maintenance workflow npm ci fails certificate verification against a blocked package mirror | CI-008 | ci | fixed | +| Supply Chain Scan image-scans job cancelled after exhausting its 40-minute timeout | CI-009 | ci | workaround | +| PR-image scan stops during a container image build rather than at a Grype High/Critical finding | CI-009 | ci | workaround | +| Slow apt index or package downloads dominate a build-tools image layer | CI-009 | ci | workaround | | The agent container can reach a domain that is not allowlisted | SEC-001 | security | needs-evidence | | A provider credential is observable inside the agent environment while the api-proxy is enabled | SEC-001 | security | needs-evidence | | Egress succeeds without a corresponding Squid access-log entry | SEC-001 | security | needs-evidence | @@ -537,6 +540,20 @@ Reuse these instead of duplicating their commands: - **Provenance:** pull-request: https://github.com/github/gh-aw-firewall/pull/11317 · pull-request: https://github.com/github/gh-aw-firewall/pull/11318 · pull-request: https://github.com/github/gh-aw-firewall/pull/11314 · pull-request: https://github.com/github/gh-aw-firewall/pull/11311 · pull-request: https://github.com/github/gh-aw-firewall/pull/11383 · pull-request: https://github.com/github/gh-aw-firewall/pull/11473 · pull-request: https://github.com/github/gh-aw-firewall/pull/11569 · pull-request: https://github.com/github/gh-aw-firewall/pull/11326 · code: scripts/ci/build-smoke-images.sh · code: scripts/ci/workflow-patches/network-and-install.ts · code: scripts/ci/workflow-patches/engine-lifecycle.ts · test: scripts/ci/smoke-image-preparation.test.ts · test: scripts/ci/copilot-token-optimizer-workflow.test.ts · test: scripts/ci/apply-general-workflow-patches.test.ts · test: scripts/ci/refactoring-scanner-workflow.test.ts · test: scripts/ci/test-quality-improver-workflow.test.ts - **Owner:** @github/gh-aw-firewall-maintainers · **Review by:** 2027-02-12 +### CI-009 — Supply-chain PR-image scan is cancelled at its job timeout during a slow package-mirror build + +- **Boundary:** ci · **Status:** workaround +- **Affects:** runner=github-hosted, runtime=any, provider=any, auth=any +- **Versions:** introduced=unknown, fixed=unknown +- **Symptoms:** Supply Chain Scan image-scans job cancelled after exhausting its 40-minute timeout · PR-image scan stops during a container image build rather than at a Grype High/Critical finding · Slow apt index or package downloads dominate a build-tools image layer +- **Discriminating conditions:** The failure is a job-level timeout or cancellation in a PR-image scan job, not a scanner finding: the build-tools build may complete and Grype may run before the job is cancelled during the next image build · Older workflow code built all nine PR images sequentially in one job sharing a single 40-minute budget · Current code runs three PR-image shards (build-tools + enclave-agent, agent, and six service images), each with a 60-minute budget; published-image CVE and license scans keep 40 minutes · enclave-agent must share a shard with build-tools because it consumes the exact locally built base image · A slow mirror, a cache-export failure and a blocking High/Critical vulnerability are different causes that must be classified from the failing step +- **Root cause:** Package retrieval from a slow mirror consumed most of one shared 40-minute budget (the originating PR measured a 36-minute build-tools layer), so the remaining image builds were cancelled. Sharding gives each independent set of images its own budget and runner; it does not make the upstream mirror faster, and no hosted run has yet shown the 60-minute budgets are sufficient under a slow mirror. +- **Safe probe:** `grep -n -e 'scan: pr-' -e 'timeout:' -e 'images:' .github/workflows/supply-chain-scan.yml` → The command checks workflow topology only: current source lists pr-toolchain, pr-agent and pr-services with a 60-minute timeout. From existing run metadata and bounded build-log timing evidence, confirm cancellation at the job limit and distinguish package retrieval, compilation, cache export and Grype execution within the combined build-and-scan step. Match the slow-mirror cause only when apt index or package-download timings show that retrieval consumed most of the shared 40-minute budget. Cancellation without a Grype finding alone is insufficient; absent timing or cancellation-reason evidence leaves the cause unknown. +- **Action:** Use source with the sharded PR-image matrix. Fix the classified step; do not disable or downgrade the blocking High/Critical gate, merge shards in a way that separates enclave-agent from build-tools, ignore cache-export failures, or raise one shared timeout to absorb all builds. Hosted acceptance remains separate; a repeat timeout at 60 minutes is new evidence, not covered by this finding. +- **Related:** CI-008 +- **Provenance:** pull-request: https://github.com/github/gh-aw-firewall/pull/11399 · code: .github/workflows/supply-chain-scan.yml · test: scripts/ci/docker-registry-ci.test.ts · doc: docs/INTEGRATION-TESTS.md#ci-image-retrieval +- **Owner:** @github/gh-aw-firewall-maintainers · **Review by:** 2027-02-12 + ## Boundary: security ### SEC-001 — Suspected isolation or credential-boundary regression must go to security review, not a bypass diff --git a/.github/workflows/shared/diagnosis-findings.md b/.github/workflows/shared/diagnosis-findings.md index 9e6b4aa01..a50f6db2a 100644 --- a/.github/workflows/shared/diagnosis-findings.md +++ b/.github/workflows/shared/diagnosis-findings.md @@ -81,6 +81,9 @@ Match the narrowest finding ID. When nothing matches, say so and request the sma | Smoke workflow exhausts its execution timeout during a cold local Docker image build | CI-008 | ci | fixed | | AWF invocation combines a compiler-pinned image manifest with --build-local | CI-008 | ci | fixed | | Maintenance workflow npm ci fails certificate verification against a blocked package mirror | CI-008 | ci | fixed | +| Supply Chain Scan image-scans job cancelled after exhausting its 40-minute timeout | CI-009 | ci | workaround | +| PR-image scan stops during a container image build rather than at a Grype High/Critical finding | CI-009 | ci | workaround | +| Slow apt index or package downloads dominate a build-tools image layer | CI-009 | ci | workaround | | The agent container can reach a domain that is not allowlisted | SEC-001 | security | needs-evidence | | A provider credential is observable inside the agent environment while the api-proxy is enabled | SEC-001 | security | needs-evidence | | Egress succeeds without a corresponding Squid access-log entry | SEC-001 | security | needs-evidence | @@ -468,6 +471,20 @@ Match the narrowest finding ID. When nothing matches, say so and request the sma - **Provenance:** pull-request: https://github.com/github/gh-aw-firewall/pull/11317 · pull-request: https://github.com/github/gh-aw-firewall/pull/11318 · pull-request: https://github.com/github/gh-aw-firewall/pull/11314 · pull-request: https://github.com/github/gh-aw-firewall/pull/11311 · pull-request: https://github.com/github/gh-aw-firewall/pull/11383 · pull-request: https://github.com/github/gh-aw-firewall/pull/11473 · pull-request: https://github.com/github/gh-aw-firewall/pull/11569 · pull-request: https://github.com/github/gh-aw-firewall/pull/11326 · code: scripts/ci/build-smoke-images.sh · code: scripts/ci/workflow-patches/network-and-install.ts · code: scripts/ci/workflow-patches/engine-lifecycle.ts · test: scripts/ci/smoke-image-preparation.test.ts · test: scripts/ci/copilot-token-optimizer-workflow.test.ts · test: scripts/ci/apply-general-workflow-patches.test.ts · test: scripts/ci/refactoring-scanner-workflow.test.ts · test: scripts/ci/test-quality-improver-workflow.test.ts - **Owner:** @github/gh-aw-firewall-maintainers · **Review by:** 2027-02-12 +### CI-009 — Supply-chain PR-image scan is cancelled at its job timeout during a slow package-mirror build + +- **Boundary:** ci · **Status:** workaround +- **Affects:** runner=github-hosted, runtime=any, provider=any, auth=any +- **Versions:** introduced=unknown, fixed=unknown +- **Symptoms:** Supply Chain Scan image-scans job cancelled after exhausting its 40-minute timeout · PR-image scan stops during a container image build rather than at a Grype High/Critical finding · Slow apt index or package downloads dominate a build-tools image layer +- **Discriminating conditions:** The failure is a job-level timeout or cancellation in a PR-image scan job, not a scanner finding: the build-tools build may complete and Grype may run before the job is cancelled during the next image build · Older workflow code built all nine PR images sequentially in one job sharing a single 40-minute budget · Current code runs three PR-image shards (build-tools + enclave-agent, agent, and six service images), each with a 60-minute budget; published-image CVE and license scans keep 40 minutes · enclave-agent must share a shard with build-tools because it consumes the exact locally built base image · A slow mirror, a cache-export failure and a blocking High/Critical vulnerability are different causes that must be classified from the failing step +- **Root cause:** Package retrieval from a slow mirror consumed most of one shared 40-minute budget (the originating PR measured a 36-minute build-tools layer), so the remaining image builds were cancelled. Sharding gives each independent set of images its own budget and runner; it does not make the upstream mirror faster, and no hosted run has yet shown the 60-minute budgets are sufficient under a slow mirror. +- **Safe probe:** `grep -n -e 'scan: pr-' -e 'timeout:' -e 'images:' .github/workflows/supply-chain-scan.yml` → The command checks workflow topology only: current source lists pr-toolchain, pr-agent and pr-services with a 60-minute timeout. From existing run metadata and bounded build-log timing evidence, confirm cancellation at the job limit and distinguish package retrieval, compilation, cache export and Grype execution within the combined build-and-scan step. Match the slow-mirror cause only when apt index or package-download timings show that retrieval consumed most of the shared 40-minute budget. Cancellation without a Grype finding alone is insufficient; absent timing or cancellation-reason evidence leaves the cause unknown. +- **Action:** Use source with the sharded PR-image matrix. Fix the classified step; do not disable or downgrade the blocking High/Critical gate, merge shards in a way that separates enclave-agent from build-tools, ignore cache-export failures, or raise one shared timeout to absorb all builds. Hosted acceptance remains separate; a repeat timeout at 60 minutes is new evidence, not covered by this finding. +- **Related:** CI-008 +- **Provenance:** pull-request: https://github.com/github/gh-aw-firewall/pull/11399 · code: .github/workflows/supply-chain-scan.yml · test: scripts/ci/docker-registry-ci.test.ts · doc: docs/INTEGRATION-TESTS.md#ci-image-retrieval +- **Owner:** @github/gh-aw-firewall-maintainers · **Review by:** 2027-02-12 + ## Boundary: security ### SEC-001 — Suspected isolation or credential-boundary regression must go to security review, not a bypass diff --git a/.github/workflows/supply-chain-scan.yml b/.github/workflows/supply-chain-scan.yml index 2273d83d1..d37791023 100644 --- a/.github/workflows/supply-chain-scan.yml +++ b/.github/workflows/supply-chain-scan.yml @@ -206,6 +206,8 @@ jobs: run: docker pull ghcr.io/anchore/grant@sha256:172463611795f43b77302cdfbd7b3f81295492a7330e0820cfe41c3674920237 - name: Authenticate to GHCR for image scanning + # Only registry-based scans need credentials; PR scans use local archives. + if: matrix.pr-images != true run: echo "${{ github.token }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin # Persist Grype's vulnerability DB across runs. The unique run_id key never diff --git a/docs/INTEGRATION-TESTS.md b/docs/INTEGRATION-TESTS.md index 134e21922..a42e00817 100644 --- a/docs/INTEGRATION-TESTS.md +++ b/docs/INTEGRATION-TESTS.md @@ -75,6 +75,11 @@ digests. Scan targets, vulnerability database updates, and the blocking High/Critical PR-image gate are unchanged. The setup script validates the merged daemon configuration before restart and refuses local or self-hosted runners. +Only published-image CVE and license scans authenticate to GHCR for registry +targets. PR-image scans use local Docker archives and public base/scanner images, +so they do not depend on GHCR accepting the workflow token. Registry retrieval +and blocking High/Critical scan failures still fail their respective steps. + PR-image builds run in three independent shards: build-tools plus enclave-agent, agent alone, and the six remaining service images. Each shard has a 60-minute budget instead of sharing one 40-minute budget across all nine images, so a slow diff --git a/docs/diagnostics/README.md b/docs/diagnostics/README.md index ba9c1a923..e9ec291c8 100644 --- a/docs/diagnostics/README.md +++ b/docs/diagnostics/README.md @@ -275,6 +275,7 @@ npm run diagnostics:freshness -- --as-of 2026-11-09 # reproducible UTC deadline | CI-006 | ci | Claude enclave agent exits 1 before initialization with an invalid launch option | fixed | [`findings/ci/CI-006.json`](./findings/ci/CI-006.json) | | CI-007 | ci | Prestarted enclave gateway cannot resolve the private enclave service after network attachment | fixed | [`findings/ci/CI-007.json`](./findings/ci/CI-007.json) | | CI-008 | ci | Agentic workflow fails in pre-agent setup before the engine starts | fixed | [`findings/ci/CI-008.json`](./findings/ci/CI-008.json) | +| CI-009 | ci | Supply-chain PR-image scan is cancelled at its job timeout during a slow package-mirror build | workaround | [`findings/ci/CI-009.json`](./findings/ci/CI-009.json) | | SEC-001 | security | Suspected isolation or credential-boundary regression must go to security review, not a bypass | needs-evidence | [`findings/security/SEC-001.json`](./findings/security/SEC-001.json) | ### Symptom lookup @@ -353,6 +354,9 @@ npm run diagnostics:freshness -- --as-of 2026-11-09 # reproducible UTC deadline | Smoke workflow exhausts its execution timeout during a cold local Docker image build | CI-008 | ci | fixed | | AWF invocation combines a compiler-pinned image manifest with --build-local | CI-008 | ci | fixed | | Maintenance workflow npm ci fails certificate verification against a blocked package mirror | CI-008 | ci | fixed | +| Supply Chain Scan image-scans job cancelled after exhausting its 40-minute timeout | CI-009 | ci | workaround | +| PR-image scan stops during a container image build rather than at a Grype High/Critical finding | CI-009 | ci | workaround | +| Slow apt index or package downloads dominate a build-tools image layer | CI-009 | ci | workaround | | The agent container can reach a domain that is not allowlisted | SEC-001 | security | needs-evidence | | A provider credential is observable inside the agent environment while the api-proxy is enabled | SEC-001 | security | needs-evidence | | Egress succeeds without a corresponding Squid access-log entry | SEC-001 | security | needs-evidence | diff --git a/docs/diagnostics/findings/ci/CI-009.json b/docs/diagnostics/findings/ci/CI-009.json new file mode 100644 index 000000000..556451b0b --- /dev/null +++ b/docs/diagnostics/findings/ci/CI-009.json @@ -0,0 +1,38 @@ +{ + "$schema": "../../schema.json", + "id": "CI-009", + "boundary": "ci", + "title": "Supply-chain PR-image scan is cancelled at its job timeout during a slow package-mirror build", + "symptoms": [ + "Supply Chain Scan image-scans job cancelled after exhausting its 40-minute timeout", + "PR-image scan stops during a container image build rather than at a Grype High/Critical finding", + "Slow apt index or package downloads dominate a build-tools image layer" + ], + "conditions": [ + "The failure is a job-level timeout or cancellation in a PR-image scan job, not a scanner finding: the build-tools build may complete and Grype may run before the job is cancelled during the next image build", + "Older workflow code built all nine PR images sequentially in one job sharing a single 40-minute budget", + "Current code runs three PR-image shards (build-tools + enclave-agent, agent, and six service images), each with a 60-minute budget; published-image CVE and license scans keep 40 minutes", + "enclave-agent must share a shard with build-tools because it consumes the exact locally built base image", + "A slow mirror, a cache-export failure and a blocking High/Critical vulnerability are different causes that must be classified from the failing step" + ], + "affects": { "runner": "github-hosted", "runtime": "any", "provider": "any", "authMode": "any" }, + "versions": { "introduced": "unknown", "fixed": "unknown" }, + "status": "workaround", + "rootCause": "Package retrieval from a slow mirror consumed most of one shared 40-minute budget (the originating PR measured a 36-minute build-tools layer), so the remaining image builds were cancelled. Sharding gives each independent set of images its own budget and runner; it does not make the upstream mirror faster, and no hosted run has yet shown the 60-minute budgets are sufficient under a slow mirror.", + "probe": { + "command": "grep -n -e 'scan: pr-' -e 'timeout:' -e 'images:' .github/workflows/supply-chain-scan.yml", + "expect": "The command checks workflow topology only: current source lists pr-toolchain, pr-agent and pr-services with a 60-minute timeout. From existing run metadata and bounded build-log timing evidence, confirm cancellation at the job limit and distinguish package retrieval, compilation, cache export and Grype execution within the combined build-and-scan step. Match the slow-mirror cause only when apt index or package-download timings show that retrieval consumed most of the shared 40-minute budget. Cancellation without a Grype finding alone is insufficient; absent timing or cancellation-reason evidence leaves the cause unknown.", + "readOnly": true, + "secretSafe": true + }, + "action": "Use source with the sharded PR-image matrix. Fix the classified step; do not disable or downgrade the blocking High/Critical gate, merge shards in a way that separates enclave-agent from build-tools, ignore cache-export failures, or raise one shared timeout to absorb all builds. Hosted acceptance remains separate; a repeat timeout at 60 minutes is new evidence, not covered by this finding.", + "references": [ + { "kind": "pull-request", "ref": "https://github.com/github/gh-aw-firewall/pull/11399" }, + { "kind": "code", "ref": ".github/workflows/supply-chain-scan.yml" }, + { "kind": "test", "ref": "scripts/ci/docker-registry-ci.test.ts" }, + { "kind": "doc", "ref": "docs/INTEGRATION-TESTS.md#ci-image-retrieval" } + ], + "related": ["CI-008"], + "owner": "@github/gh-aw-firewall-maintainers", + "reviewBy": "2027-02-12" +} diff --git a/scripts/ci/docker-registry-ci.test.ts b/scripts/ci/docker-registry-ci.test.ts index 838cd47fa..198835dc2 100644 --- a/scripts/ci/docker-registry-ci.test.ts +++ b/scripts/ci/docker-registry-ci.test.ts @@ -67,6 +67,17 @@ describe('CI registry retrieval', () => { const prShards = jobs('supply-chain-scan.yml')['image-scans'].strategy!.matrix.include .filter(shard => shard['pr-images']); + it('authenticates registry scans without making local PR-image scans depend on GHCR login', () => { + const steps = jobs('supply-chain-scan.yml')['image-scans'].steps; + const login = steps.find(step => step.name === 'Authenticate to GHCR for image scanning')!; + expect(login.if).toBe('matrix.pr-images != true'); + expect(login.run).toContain('docker login ghcr.io'); + expect(login['continue-on-error']).toBeUndefined(); + const blocking = steps.find(step => step.name?.startsWith('Build and scan PR container images'))!; + expect(blocking.run).toContain("f'docker-archive:{tar}'"); + expect(blocking.run).not.toContain('.docker/config.json'); + }); + it.each(prShards.flatMap(shard => [ ['success', '2026-11-04'], ['success', '2026-11-05'], diff --git a/src/cloud-hypervisor/vmm-identity-lifecycle.test.ts b/src/cloud-hypervisor/vmm-identity-lifecycle.test.ts index 6ead3ae8a..d91e97969 100644 --- a/src/cloud-hypervisor/vmm-identity-lifecycle.test.ts +++ b/src/cloud-hypervisor/vmm-identity-lifecycle.test.ts @@ -950,6 +950,9 @@ describe('CloudHypervisorVmmIdentityManager', () => { const second = createAccountName(); expect(first).toMatch(/^awfvmm-[a-f0-9]{20}$/); expect(second).not.toBe(first); - expect(first).not.toContain(String(process.pid)); + // Random hex can contain the PID digits by chance; assert only that the suffix is not PID-derived. + const suffix = first.slice('awfvmm-'.length); + expect(suffix).not.toBe(String(process.pid).padStart(20, '0')); + expect(suffix).not.toBe(process.pid.toString(16).padStart(20, '0')); }); }); diff --git a/tests/integration/filesystem-allowwrite.test.ts b/tests/integration/filesystem-allowwrite.test.ts index a14d55f93..04552d469 100644 --- a/tests/integration/filesystem-allowwrite.test.ts +++ b/tests/integration/filesystem-allowwrite.test.ts @@ -3,6 +3,7 @@ * * These tests cover live container startup behavior that unit tests of volume * rewriting cannot catch, such as Docker/runc mountpoint creation order. + * Use the images prepared by test-integration-suite.yml, without rebuilding or pulling. */ /// @@ -43,7 +44,7 @@ describe('filesystem.allowWrite', () => { allowWrite: [writableDir], }, container: { - buildLocal: true, + skipPull: true, }, logging: { logLevel: 'debug', @@ -73,7 +74,7 @@ describe('filesystem.allowWrite', () => { fs.writeFileSync(configPath, JSON.stringify({ network: { allowDomains: ['github.com'] }, filesystem: { allowWrite: [writableDir] }, - container: { buildLocal: true }, + container: { skipPull: true }, logging: { logLevel: 'debug' }, security: { legacySecurity: true }, })); @@ -103,7 +104,7 @@ describe('filesystem.allowWrite', () => { fs.writeFileSync(configPath, JSON.stringify({ network: { allowDomains: ['github.com'] }, filesystem: { allowWrite: [writableDir] }, - container: { buildLocal: true }, + container: { skipPull: true }, logging: { logLevel: 'debug' }, security: { legacySecurity: true }, }));