Skip to content

GH-3 — Fail-closed CodeQL analysis verification - #87

Merged
kryptek2000 merged 2 commits into
mainfrom
chore/gh3-codeql-governance-gate
Dec 2, 2026
Merged

kryptek2000 merged 2 commits into
mainfrom
chore/gh3-codeql-governance-gate

Conversation

@kryptek2000

Copy link
Copy Markdown
Owner

Purpose

Add the independently audited, fail-closed CodeQL Analysis Gate workflow.

This PR contains exactly one new file:

  • .github/workflows/codeql-analysis-gate.yml

It does not modify application source, existing workflows, CodeQL default setup, or repository rules.

Why native aggregate CodeQL alone is insufficient

GitHub's native aggregate CodeQL check can complete as neutral when CodeQL default setup does not analyze a Dependabot PR head. GitHub accepts neutral and skipped as satisfying required status checks. Historical PRs #48–#50 demonstrated this exact fail-open path: nine successful application checks, zero CodeQL analyses, a neutral aggregate, and a mergeable PR.

What the gate verifies

The gate requires all of the following for the exact PR candidate:

  • Exactly one associated dynamic CodeQL run for the PR head.
  • That sole run is at run_attempt == 1.
  • The first observed run ID is remembered for the invocation and cannot be replaced.
  • Attempt 1 is validated through the supported workflow-run-attempt API.
  • All four analysis configurations exist for the exact head/ref:
    • /language:actions
    • /language:c-cpp
    • /language:javascript-typescript
    • /language:python
  • Analysis records are no older than the first attempt start.
  • The aggregate CodeQL check from app 57789 is success.
  • Missing, neutral, failed, cancelled, stale, ambiguous, or multiple-run/attempt evidence fails closed.

Policy

  • Zero associated CodeQL runs: wait within the 300-second start deadline.
  • One run at attempt 1: eligible.
  • More than one associated run or any attempt greater than 1: fail with an actionable message directing the owner to push a fresh reviewed commit.
  • Empty inventory never clears the remembered run identity.
  • The gate rerun itself is not a CodeQL retry; a CodeQL workflow rerun creates a rejected attempt.

The workflow is read-only, does not check out PR code, and uses only the built-in job token with:

  • actions: read
  • contents: read
  • checks: read
  • pull-requests: read
  • security-events: read

Independent audit

  • Implementation fixture matrix: 57/57 expected outcomes.
  • Independent F5 fixtures: 26/26 expected outcomes.
  • All eleven previous false-acceptance regressions remain rejected.
  • Persistent run identity defect closed.
  • No remaining demonstrated blocking defects.

Accepted owner/auditor trust boundary: the workflow runs from the PR merge commit and is not an immutable workflow signature. Workflow changes require owner review and Luna's independent audit.

Hosted acceptance

This PR is the positive hosted acceptance case. Verification must record:

  • real job-token access to workflow runs, attempt 1, check runs, and Code Scanning analyses;
  • one associated CodeQL run at attempt 1;
  • four analysis records for the exact candidate;
  • native aggregate success from app 57789;
  • CodeQL Analysis Gate success from app 15368;
  • all nine existing application CI contexts.

A genuine missing-analysis negative hosted case remains required before separate ruleset activation.

Governance

Ruleset 25398176 is not modified or activated by this PR. The accepted eleven-context governance payload remains byte-identical at SHA-256 495c242241f067d1fab038ce70937bc2d21592a4281d22bdec3e4d96efbfc845. Ruleset activation requires separate Product Owner authorization after hosted positive and negative acceptance.

@kryptek2000
kryptek2000 merged commit c354918 into main Dec 2, 2026
15 checks passed
@kryptek2000
kryptek2000 deleted the chore/gh3-codeql-governance-gate branch December 2, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant