I once watched a "safe" CI workflow hand its repository secrets to a stranger. The workflow used pull_request_target so it could label and comment on pull requests from forks. It also ran actions/checkout on the fork's branch so it could build the change. That second step is all an attacker needs.
That pattern has a name in the GitHub security community: the pwn request. It has burned big projects and plenty of small repos that never made the news. On June 18, 2026, actions/checkout v7 finally changed the default so this footgun stops firing on its own.
Here's what the pwn request actually is, what v7 changes, and the part that will catch teams off guard: the new default backports to v4, v5, and v6 on July 16, 2026.
What is the pull_request_target "pwn request" problem?
A pwn request is what happens when a workflow runs with pull_request_target and then checks out untrusted fork code. The pull_request_target event runs in the context of the base repository, with a read/write GITHUB_TOKEN and access to your secrets. That is the whole reason it exists: a fork PR can trigger a workflow that comments, labels, or posts a status check without the fork ever seeing those secrets.
The trouble starts the moment you also check out the pull request's head commit. Now attacker-controlled code is sitting on the runner inside a job that has your secrets in scope. A malicious postinstall script in package.json, a tampered Makefile, a sneaky build step that reads an environment variable and curls it to an external host, any of these runs with full trust.
Here is the shape of the dangerous workflow. It looks reasonable. It builds a contributor's PR and posts the result back.
# DANGEROUS: runs with secrets AND checks out untrusted fork code
on:
pull_request_target:
types: [opened, synchronize]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
- run: npm ci && npm run build # fork-controlled scripts run with your secretsThe ref: line is the problem. It pulls the fork's exact commit into a privileged job. npm ci then executes whatever lifecycle scripts that fork defined. This is not a theoretical risk. The tj-actions/changed-files compromise, the Nx token theft, and the Ultralytics PyPI incident all trace back to a privileged workflow trusting code it should not have.
What changed in actions/checkout v7?
In actions/checkout v7, the action refuses by default to check out fork pull request code when the workflow is triggered by pull_request_target or workflow_run. The release went GA on June 18, 2026.
The action now inspects what you asked it to check out. If the repository, ref, or resolved commit points at a fork, a pull merge ref like refs/pull/<number>/head, a fork repository reference, or a fork commit SHA, and the event is pull_request_target or workflow_run, it stops with an error instead of fetching that code. The exact workflow above now fails on the checkout step rather than quietly running the fork's scripts.
If you have a real reason to keep the old behavior, there is an explicit opt-in:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}
allow-unsafe-pr-checkout: true # you are now responsible for the riskGitHub chose that name on purpose. From the changelog: "The flag is intentionally named to be easy to spot in code review and static analysis." You cannot turn this off by accident, and a reviewer scanning a diff will see exactly what it does. v7 also moves the action to ESM and refreshes its dependencies, but the security default is the headline.
The important detail for everyday use: same-repository pull requests are not affected, and the standard pull_request event is unchanged. If your contributors push branches to your repo rather than forks, nothing changes. The block targets the exact combination that leaks secrets: a privileged trigger plus untrusted fork code.
How do you upgrade safely before the July 16 backport?
You probably do not need to touch anything to get the safer behavior, because GitHub is backporting it to every supported major version on July 16, 2026. That is also the part most likely to surprise you.
Workflows that use a floating major tag like actions/checkout@v4, @v5, or @v6 pick up the backport automatically on that date. If one of those workflows does an unsafe fork checkout in a pull_request_target job, it will start failing on July 16 with no change on your side. Workflows pinned to a specific commit SHA, or a full version like @v6.0.1, are not affected by the backport and keep their old behavior until you upgrade them through Dependabot or your normal process.
So before mid-July, do three things. First, grep your .github/workflows for pull_request_target and workflow_run. Second, for each hit, check whether a later actions/checkout step uses a fork-controlled ref. Third, decide per workflow: rework it into the safe pattern below, or accept the new failure as a signal that the workflow was unsafe all along. If you pin actions by SHA (a good supply-chain practice on its own, which I covered in npm trusted publishing with GitHub Actions OIDC), remember the backport will not reach you, so you own the upgrade timing.
How should you check out fork PR code when you actually need it?
When you genuinely need to build or test fork code, do it in a job that has no secrets, never in a pull_request_target job. The standard safe pattern splits the work across two events so attacker-controlled code and your secrets never sit in the same job.
The first workflow runs on pull_request, which gets no access to secrets for fork PRs. It builds the untrusted code and uploads the result.
name: build-untrusted
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v7 # safe: pull_request has no secrets for forks
- run: npm ci && npm run build
- uses: actions/upload-artifact@v4
with:
name: pr-build
path: dist/The second workflow runs on workflow_run after the first finishes. It holds the secrets and the write permissions, but it only downloads the artifact. It never checks out fork code.
name: comment-results
on:
workflow_run:
workflows: [build-untrusted]
types: [completed]
jobs:
comment:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/download-artifact@v4
with:
name: pr-build
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
# use the artifact to post a comment. never run fork scripts here.This is the pattern GitHub itself recommends, and v7's default nudges everyone toward it. The build job can run anything the fork wants, because there is nothing valuable in that job to steal. The privileged job only ever touches a static artifact. If you need human review before trusting a PR, add a label gate or a protected environment to the second workflow so a maintainer has to approve the run.
When is allow-unsafe-pr-checkout actually OK?
Almost never on a public repository. The opt-in exists for a small set of cases: private repos where every contributor is already trusted, internal forks inside an organization, or a short migration window while you move a workflow to the safe pattern. On a public repo, setting allow-unsafe-pr-checkout: true re-opens the exact hole v7 closed.
If you do set it, treat it like any other dangerous switch. Pin it to the narrowest workflow possible, write a comment next to it explaining why, and add a reminder to remove it. The greppable name is there so your future self, and your security scanner, can find every place you made that promise. The day you stop being able to justify the comment is the day you delete the flag.
What does this mean for CI security going forward?
The real shift here is not one action's default. It is that the platform is moving from "secure if you read every security guide" to "secure unless you explicitly opt out." For years, avoiding the pwn request meant knowing an obscure interaction between two events and a checkout step. Now the unsafe path errors out and tells you why. That is a much better place for a default to sit, because the people most likely to write the dangerous workflow are exactly the ones who never read the security hardening docs.
If you maintain any public repo with fork contributors, audit your workflows this week rather than waiting for July 16 to do it for you. A failing build is a friendly way to learn you had a hole. A stolen token is not.
For the full details, see the GitHub changelog for safer pull_request_target defaults, the actions/checkout release notes, the GitHub Security Lab write-up on preventing pwn requests, and the GitHub Actions security hardening guide.
Keep Reading
- How to Enable npm Trusted Publishing with GitHub Actions OIDC. Lock down the other half of your CI supply chain with short-lived OIDC tokens instead of long-lived secrets.
- TanStack npm Supply Chain Attack 2026: How OIDC Beat SLSA. A real-world look at how a CI compromise plays out and what actually stopped it.
- How to Recover echarts-for-react After the May 2026 AntV Attack. Incident-response steps for when a dependency in your pipeline goes bad.