fix(codeql): grant private consumers pull-request and status reads - #2145
Conversation
Refs ContextualWisdomLab/late-life-anxiety-reanalysis#10. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 51 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Infrastructure-exception merge record (operator guideline §11), head Substantive gates passed on this head: Bandit, Semgrep (multi-language), gitleaks, pip-audit, required-workflow-bootstrap, scan-pr-queue, coverage-evidence, Dispatch current-head CodeQL scan. Effective token on the run itself shows the new grants applied ( Not terminal at merge time: the two CodeQL shards are in their designed pending-fail state waiting for Substitute verification: RED→GREEN contract test, 149 focused / 3040 full tests pass, actionlint clean (PR body). Deferred verification to re-run after merge: CodeQL (actions) on main and the consumer's exact-head CodeQL shards on late-life-anxiety-reanalysis PR #10; if either surfaces a finding attributable to this change, revert. |
Problem
The org-required workflow
.github/workflows/codeql-pr.ymlfails both of its jobs whenever a private consumer repository runs it. InContextualWisdomLab/late-life-anxiety-reanalysisPR #10 (heada1cd5bc6783c6510dfcf937f523c733366e82213, run34700410434), both jobs failed at their first API call withgh: Resource not accessible by integration (HTTP 403):CodeQL compatibility analysis (python)(job103571590442), step "Read current-head CodeQL dispatch verdict", callinggh api "repos/${TARGET_REPOSITORY}/pulls/${PR_NUMBER}"under a token whose effective permissions were only Contents: read, Metadata: read (declaredcontents: read,id-token: write).Dispatch current-head CodeQL scan(job103571810868), the same GET plus a later read ofrepos/${TARGET_REPOSITORY}/commits/${PR_HEAD_SHA}/statuses, undercontents: read,id-token: write,actions: read.Public consumers (fast-mlsirm, pg-erd-cloud, naruon, html4tree) passed only because an unauthenticated-equivalent GET on a public repository doesn't require the grant. GitHub's REST contract requires
pull-requests: readfor "Get a pull request" andstatuses: readfor "List commit statuses for a reference" on private repositories.Boundary
pull-requests: readandstatuses: readto theanalyze-headanddispatch-current-headjobpermissions:blocks in.github/workflows/codeql-pr.yml.actions: writeremains absent, still guarded by the existingtest_codeql_required_workflow_does_not_gain_actions_writetest.contents,id-token,[actions],pull-requests,statuses.TDD evidence
RED — new focused test before the fix:
GREEN — same test after the fix:
Focused suite (five CodeQL / required-workflow contract files): 149 passed.
Full repository suite: 3040 passed, 1 skipped, 36 subtests passed in 471.09s (the 1 skip is pre-existing and unrelated:
tests/test_opencode_rust_coverage_toolchain_contract.py:195, reviewed LLVM 19 tools not installed on this host). No warnings.actionlint -shellcheck= -pyflakes= .github/workflows/codeql-pr.yml: clean (exit 0, no output).Hosted acceptance still required
This repair is unverified against GitHub's live permission enforcement. A newly loaded central SHA carrying this change must still pass both
analyze-headanddispatch-current-headon the private consumer's exact current head before this is resolved end-to-end. Separately, the laterrepository_dispatchPOST fromdispatch-current-headtoContextualWisdomLab/.githubusing the OpenCode app token has not yet been exercised from a private consumer at all, and may surface a distinct scoping issue of its own once this read-permission blocker is cleared.Refs ContextualWisdomLab/late-life-anxiety-reanalysis#10.
🤖 Generated with Claude Code