fix(ci): preserve CodeQL PR checkout history and exclude non-shipped verifiers (#14385)

* fix(ci): preserve CodeQL PR checkout history and exclude non-shipped verifiers

* test(ci): verify planCodeqlLanguages excludes non-shipped verifiers
This commit is contained in:
morluto authored and GitHub committed 2026-11-24 17:51:18 +00:00
1 parent 79efc75a11
commit 42bbf33f2d
4 files changed
+41 -4

No files matched your search

+5 -1
View File
@@ -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"
+8 -1
View File
@@ -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
+3
View File
@@ -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",
@@ -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"],
});