diff --git a/.github/codeql/production.yml b/.github/codeql/production.yml index f96a1c7609..b442fc9c89 100644 --- a/.github/codeql/production.yml +++ b/.github/codeql/production.yml @@ -11,10 +11,14 @@ paths: # Keep the default query suite and all production roots, including bridge/, # install.sh, runtime scripts, release controllers, and GitHub Actions. -# Exclude test inputs at extraction time so they cannot taint production callers. +# Exclude test inputs and non-shipped local/CI verifiers at extraction time so +# they cannot taint production callers or emit local-input path-injection noise. paths-ignore: - tests - scripts/fixtures + - scripts/verify + - "scripts/verify-real-*.mjs" + - "scripts/verify-*-client.mjs" - "**/*.test.*" - "**/*.fixture.*" - "**/test_*.py" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 46f6aa632a..9f70bffb54 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -6,6 +6,9 @@ on: paths-ignore: - "tests/**" - "scripts/fixtures/**" + - "scripts/verify/**" + - "scripts/verify-real-*.mjs" + - "scripts/verify-*-client.mjs" - "**/*.test.*" - "**/*.fixture.*" - "**/test_*.py" @@ -20,6 +23,9 @@ on: paths-ignore: - "tests/**" - "scripts/fixtures/**" + - "scripts/verify/**" + - "scripts/verify-real-*.mjs" + - "scripts/verify-*-client.mjs" - "**/*.test.*" - "**/*.fixture.*" - "**/test_*.py" @@ -55,7 +61,8 @@ jobs: steps: - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: - fetch-depth: ${{ github.event_name == 'pull_request' && 0 || 1 }} + # Keep the nonzero branch first: numeric 0 is falsy in Actions expressions. + fetch-depth: ${{ github.event_name != 'pull_request' && 1 || 0 }} filter: blob:none sparse-checkout: | .nvmrc diff --git a/scripts/ci/codeql-scope.mjs b/scripts/ci/codeql-scope.mjs index 4874e3673b..06d379b018 100644 --- a/scripts/ci/codeql-scope.mjs +++ b/scripts/ci/codeql-scope.mjs @@ -10,6 +10,9 @@ export const CODEQL_LANGUAGES = ["javascript-typescript", "python", "actions"]; const EXCLUDED_PATTERNS = [ "tests/**", "scripts/fixtures/**", + "scripts/verify/**", + "scripts/verify-real-*.mjs", + "scripts/verify-*-client.mjs", "**/*.test.*", "**/*.fixture.*", "**/test_*.py", diff --git a/tests/boundary/filesystem/ciCodeqlScope.test.ts b/tests/boundary/filesystem/ciCodeqlScope.test.ts index a4e84be670..7579ba021a 100644 --- a/tests/boundary/filesystem/ciCodeqlScope.test.ts +++ b/tests/boundary/filesystem/ciCodeqlScope.test.ts @@ -97,6 +97,9 @@ it.each([ "tests/support/analysis-efficiency/resource-run.py", "scripts/fixtures/http3-lab.py", "scripts/fixtures/managed/pe.mjs", + "scripts/verify/advertised-schemas/engines.py", + "scripts/verify-real-browser.mjs", + "scripts/verify-qwen-client.mjs", "src/process/ExecFileOutput.test.ts", "src/process/ProcessOwnership.fixture.ts", "scripts/lib/http3-verifier-lifecycle.test.mjs", @@ -166,6 +169,13 @@ it("uses the scope in a bounded workflow gated on administrator activation", () expect(workflowDocument.jobs.scope.if).toBe( "vars.REA_CODEQL_ADVANCED == 'true'", ); + const scopeCheckout = workflowDocument.jobs.scope.steps.find((step) => + step.uses?.startsWith("actions/checkout@"), + ); + // Numeric 0 is falsy in Actions expressions; keep the nonzero branch first. + expect(scopeCheckout?.with?.["fetch-depth"]).toBe( + "${{ github.event_name != 'pull_request' && 1 || 0 }}", + ); const job = workflowDocument.jobs.analyze; expect(job.if).toBe( "vars.REA_CODEQL_ADVANCED == 'true' && needs.scope.outputs.run == 'true'", @@ -221,15 +231,28 @@ it("selects affected CodeQL languages on pull requests and fails closed on share "src/process/ExecFileOutput.test.ts", "docs/development/testing.md", "bridge/ghidra/ReaGhidraBridge.java", + "scripts/verify/advertised-schemas/engines.py", + "scripts/verify-real-browser.mjs", + "scripts/verify-qwen-client.mjs", ]), ).toMatchObject({ run: false, languages: [] }); expect( - selectPr(["src/process/ExecFileOutput.ts", "docs/.vitepress/config.ts"]), + selectPr([ + "src/process/ExecFileOutput.ts", + "docs/.vitepress/config.ts", + "scripts/verify/advertised-schemas/engines.py", + ]), ).toMatchObject({ run: true, languages: ["javascript-typescript"], }); - expect(selectPr(["bridge/pwndbg/launch.py"])).toMatchObject({ + expect( + selectPr([ + "bridge/pwndbg/launch.py", + "scripts/verify-real-browser.mjs", + "scripts/verify-qwen-client.mjs", + ]), + ).toMatchObject({ run: true, languages: ["python"], });