Skip to content

CodeQL dispatch cannot prove GHAS identity because target-repo analyses API returns 403 #2276

Description

@seonghobae

Finding

The central CodeQL dispatch can complete an exact-head Python scan and produce clean SARIF, but its GHAS base/head configuration-identity proof cannot read the target repository's Code Scanning analyses.

Reproduced on ContextualWisdomLab/TEPP#538:

  • target head: 0a6947b11f2dba9e161f2abe8bdec0f652d4b47a
  • protected base: a243f18da4a4ca8a8d068c39922537f1f8ed6ad0
  • required target-repo CodeQL run: 35045658451
  • canonical owner dispatch run: .github 35276762974
  • canonical source: .github@64aa08d7fa487deacd41c761c36277ca68cab6c9
  • Python SARIF gate: files=1 results=0 medium_plus=0

Immediately afterward, Verify GHAS base/head CodeQL configuration identity called scripts/ci/codeql_ghas_configuration_identity.py, which requests GET /repos/ContextualWisdomLab/TEPP/code-scanning/analyses. The authenticated request failed:

GitHub API GET failed with HTTP 403: {"message":"Resource not accessible by integration", ...}

The same run later received HTTP 403 when attempting cross-repository commit-status publication with the available target App/GITHUB tokens. That status-publication gap is related to #1929, but this issue owns the distinct Code Scanning analyses read authority required by the newer GHAS identity contract.

Why this is not a TEPP source finding

The exact Python CodeQL analysis itself completed and its SARIF gate reported zero results. The failure occurs only when the central owner tries to query authenticated GHAS analysis metadata in the target repository. Treating 403 as “no baseline” would weaken the identity proof and is not acceptable.

Required repair

  1. Determine which credential is intended to own cross-repository code-scanning/analyses reads for codeql-scan-dispatch.yml.
  2. Give that credential the narrow target-repository permission needed to list Code Scanning analyses (GitHub App installation/repository security-events/code-scanning read as applicable), without broadening unrelated write authority.
  3. Preserve fail-closed behavior for 401/403/transport errors; do not translate unreadable evidence into an empty identity set.
  4. Add a contract/canary proving an unchanged target PR head can read both protected-base and exact-head CodeQL analyses and complete wait_for_language_pairing().
  5. Re-run the TEPP Give direct-OpenAI Strix scans GitHub Models fallbacks #538 exact-head dispatch after the current TEPP repair head is available; Python and Actions shards must both produce authenticated current-head verdicts.

Boundary

This is a canonical .github/GitHub App permission-path repair. Do not copy the identity logic into TEPP and do not weaken target-repository CodeQL gates. The separate TEPP Actions cache-poisoning findings are tracked in TEPP #594 and are being repaired in the TEPP owner.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority: highHigh-priority or P1 work

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions