Skip to content

fix(ci): allow CodeQL to check out fork PR head SHA - #220

Merged
bug-ops merged 1 commit into
mainfrom
fix/codeql-fork-pr-checkout
Jul 24, 2026
Merged

fix(ci): allow CodeQL to check out fork PR head SHA#220
bug-ops merged 1 commit into
mainfrom
fix/codeql-fork-pr-checkout

Conversation

@bug-ops

@bug-ops bug-ops commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • actions/checkout@v7 refuses to check out a fork pull request's head SHA inside a pull_request_target workflow unless explicitly opted in (a new "pwn request" guard) — this has been failing CodeQL analysis on every fork-originated PR (e.g. docs: add ty language server configuration #208) since the checkout v6 -> v7 bump
  • Set allow-unsafe-pr-checkout: true on the CodeQL workflow's checkout step
  • This is safe here: the job carries no secrets (top-level permissions: {}) and the analyze job's permissions are scoped to security-events: write + contents: read only, matching the threat-model comment already documented in the workflow

Test plan

  • fy lint .github/workflows/codeql.yml — no errors (pre-existing style infos only)
  • Confirm Analyze (actions) / Analyze (rust) pass once this merges and PR docs: add ty language server configuration #208 (or another fork PR) re-runs CodeQL

@github-actions github-actions Bot added documentation Improvements or additions to documentation ci/cd CI/CD pipeline changes labels Jul 24, 2026
actions/checkout@v7 added a guard that refuses to check out a fork
pull request's head SHA inside a pull_request_target workflow unless
explicitly opted in, breaking CodeQL analysis on every fork-originated
PR (e.g. #208) since the checkout v6 -> v7 bump.

Set allow-unsafe-pr-checkout: true, which is safe for this workflow:
it carries no secrets and permissions are scoped to
security-events:write and contents:read only, per the existing
threat-model comment.
@bug-ops
bug-ops force-pushed the fix/codeql-fork-pr-checkout branch from 98dd86f to a78474f Compare July 24, 2026 18:46
@bug-ops
bug-ops enabled auto-merge (squash) July 24, 2026 18:46
@bug-ops
bug-ops merged commit 7808953 into main Jul 24, 2026
27 checks passed
@bug-ops
bug-ops deleted the fix/codeql-fork-pr-checkout branch July 24, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd CI/CD pipeline changes documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant