Repository navigation
ci: bump actions/checkout to v7 and add allow-unsafe-pr-checkout flag - #30460
Conversation
Fork PRs against every pull_request_target workflow have been failing with: Error: Refusing to check out fork pull request code from a 'pull_request_target' workflow. ... set 'allow-unsafe-pr-checkout: true' on the actions/checkout step. This is the safe-defaults behaviour introduced in actions/checkout v7.0.0 and backported to v5.1.0 / v6.1.0 (https://github.blog/changelog/2026-06-18-safer-pull_request_target-defaults-for-github-actions-checkout/). Every fork checkout under pull_request_target must now opt in explicitly. Two-part fix across all 19 workflows that check out fork PR code under pull_request_target: 1. Bump `actions/checkout@v5` (and remaining `@v4`) to `@v7`. Devops asked for currency, and v7.0.1 also refines the check to skip when `ref:` is unspecified — helpful for any future workflow that uses the default checkout. 2. Add `allow-unsafe-pr-checkout: true` on every checkout step that fetches `github.event.pull_request.head.sha` under pull_request_target. Checkouts that use `github.sha` (base branch tip) or the default ref remain untouched — those don't run fork code. The pwn-request risk the opt-in flag warns about is mitigated for these workflows the same way it was pre-#30310: - pull_request_target continues to run the BASE branch's workflow YAML (fork edits to workflow files are ignored) - Test/build steps consume the fork tree inside docker containers or sandboxed compilers (mvn, yarn, python venv), not directly in the workflow runner shell - Workflows that require executing fork-controlled JS/scripts directly (e.g., github-script running a PR-supplied .cjs) are separately responsible for using base.sha, not head.sha (see #30453 for the playwright-summary case) Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Code Review ✅ ApprovedBumps actions/checkout to v7 and adds the allow-unsafe-pr-checkout flag across 19 workflows to fix failing fork PR checkouts under pull_request_target. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
| uses: actions/checkout@v5 | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| ref: ${{ github.event_name == 'merge_group' && github.sha || github.event.pull_request.head.sha }} |
There was a problem hiding this comment.
| uses: actions/checkout@v5 | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha }} |
There was a problem hiding this comment.
Fork build receives writable token
When an approved fork PR runs, this checkout loads its pom.xml and build configuration before Maven executes with GITHUB_TOKEN in the environment; a malicious build plugin can use the job's checks: write permission to exfiltrate the token or modify repository check runs.
Summary
Fork PRs against every `pull_request_target` workflow have been failing with:
```
Error: Refusing to check out fork pull request code from a 'pull_request_target' workflow.
... set 'allow-unsafe-pr-checkout: true' on the actions/checkout step.
```
This is the safe-defaults behaviour introduced in `actions/[email protected]` and backported to `v5.1.0` / `v6.1.0` — see GitHub Changelog: Safer pull_request_target defaults for GitHub Actions checkout. Every fork checkout under `pull_request_target` must now opt in explicitly.
The old (pre-#30310) workflows had this opt-in already; the rewrite dropped it in the process of bumping actions versions.
Change
Two-part fix across all 19 workflows that check out fork PR code under `pull_request_target`:
Bump `actions/checkout@v5` (and remaining `@v4`) to `@v7`. Devops asked for currency, and v7.0.1 also refines the check to skip when `ref:` is unspecified — helpful for future workflows that use the default checkout.
Add `allow-unsafe-pr-checkout: true` on every checkout step that fetches `github.event.pull_request.head.sha` under `pull_request_target`. Checkouts that use `github.sha` (base branch tip) or the default ref remain untouched — those don't run fork code.
Files touched (19)
19 files, +48 / −25 lines. Purely mechanical — no logic, trigger, or test changes.
Security posture unchanged
The pwn-request risk the opt-in flag warns about is mitigated the same way it was pre-#30310:
Not in scope
Test plan
🤖 Generated with Claude Code
Greptile Summary
This PR updates checkout usage for fork-testing workflows.
Confidence Score: 2/5
This PR is not safe to merge until fork-controlled execution is isolated from external-service credentials and write-capable repository tokens.
Approved fork runs execute attacker-controlled build or test code in jobs that inject sensitive service credentials or a GitHub token capable of modifying check runs.
.github/workflows/playwright-mysql-e2e.yml, .github/workflows/playwright-sso-tests.yml, .github/workflows/playwright-integration-tests-mysql.yml, .github/workflows/playwright-integration-tests-postgres.yml, .github/workflows/maven-sonar-build.yml
Security Review
The unsafe opt-in restores fork test execution, but affected jobs execute fork-controlled build or test code with external-service credentials or a write-capable GitHub token, enabling credential exfiltration and unauthorized check-run modification after a fork run is approved.
Important Files Changed
Sequence Diagram
Reviews (1): Last reviewed commit: "ci: bump actions/checkout to v7 and add ..." | Re-trigger Greptile