Skip to content

Guide library

Guide · Tools & workflows

pull_request_target Blocked? Fix Each Workflow Safely

GitHub blocks pull_request_target by default in public repositories since 2 December 2026. How to find affected workflows, move each to a safer event or allow it narrowly, and close the gaps both guards miss.

Owen Prestwick · Dec 3, 2026 · 8 min read

GitHub Changelog card with the label Retired, used for the pull_request_target enforcement notice
GitHub, pull_request_target enforcement begins December 2 (GitHub Changelog, Open Graph image), Dec 2, 2026. Source: https://github.blog/changelog/2026-12-02-github-actions-will-block-pull-request-target-by-default-in-affected-public-repo/

Since 2 December 2026, GitHub Actions blocks pull_request_target workflows by default in public repositories. If a bot that labels pull requests or posts coverage comments went quiet this week, this is the likely reason, and the fix is not always to switch the trigger back on.

GitHub now has two separate guards against the "pwn request" pattern: this new event policy, and a refusal inside actions/checkout that has existed since June. They catch different things, and a few common setups slip past both. Below is a map of which guard stops which pattern, and a per-job recipe: move it to pull_request, split it into two workflows, or allow it on purpose. Everything here comes from GitHub's changelog, docs and the checkout release notes, checked 3 Dec 2026. Metarix did not run these workflows.

What changed, and who has to act

GitHub announced the change on 2 November, ran two enforcement brownouts on 9 and 16 November (16:00 to 18:00 UTC each), and switched it on for good on 2 December. A public repository that has no applicable Actions event policy now gets a default policy that blocks pull_request_target. Blocked runs fail with an error, and the workflow does not execute.

Scope matters here. The rule covers public repositories on GitHub Free, Team and Enterprise Cloud. Private and internal repositories are not affected, and neither is GitHub Enterprise Server. If you already set an event policy that covers the repository, yours still applies.

Only three roles can fix a blocked workflow through policy: repository administrators, organization owners and enterprise owners, according to GitHub's governance guide. A contributor who sees a red run can rewrite the workflow file, but cannot allow the event.

The second guard is older. actions/checkout v7, released on 18 June 2026, refuses to check out a fork's pull request head or merge commit when the workflow runs on pull_request_target, or on workflow_run started by a pull request event. On 20 July GitHub backported that refusal to v2 through v6. Only floating major tags such as @v4 picked it up. A workflow pinned to an older commit SHA, or to a patch version like v4.3.1, still behaves the old way.

Which guard catches what

Matrix showing which pwn-request patterns are stopped by GitHub default pull_request_target event policy and by the actions/checkout fork guard
Metarix original editorial graphic, 3 Dec 2026. Summarises documented behaviour from GitHub's changelog, docs and actions/checkout release notes; it is not a test result.

Read the matrix as a list of places to look. Three gaps matter most.

  • Old SHA pins. Pinning actions to a commit SHA is good practice. But a SHA from a release older than the guarded ones (v7.0.0, v6.1.0, v4.4.0 and their siblings) means the checkout guard never arrived. If you allowed pull_request_target for that workflow, nothing stops a fork's code from running with your secrets.
  • Code fetched outside checkout. The checkout guard looks only at its own ref and repository inputs. A run: step that calls git fetch or gh pr checkout is not covered, as GitHub's June changelog says plainly.
  • Other privileged events. The default policy targets pull_request_target only. A workflow_run job that runs an artifact built by a fork's PR, or an issue_comment "/test" command that pulls PR code, is still a pwn request. GitHub's security guide says artifacts from fork runs must be treated as untrusted data.

Step 1: find the affected workflows

  1. Open Settings → Actions → Policies → Policy insights in the repository or organization. It lists runs that were blocked by an active policy, or would have been under an Evaluate one.
  2. Search the code for the trigger and the risky inputs: pull_request_target, workflow_run, head.sha, refs/pull/, head.repo.full_name, gh pr checkout and allow-unsafe-pr-checkout.
  3. Note how each workflow pins actions/checkout. Floating @v2 to @v7 tags have the guard. For SHA pins, check the commit against the release list: the guarded releases are v7.0.0 and later, v6.1.0, v5.1.0, v4.4.0, v3.7.0 and v2.8.0. v1 never got it.
  4. Write down, for each workflow, what it needs: a write token, a secret, the fork's code, or only the PR metadata. That decides the fix.

Step 2: pick the fix for each job

Scroll the table horizontally on smaller screens.

Common pull_request_target jobs and the safer setup for each
What the workflow doesNeedsRecommended fix
Labels, triages or greets new PRsWrite token, PR metadata onlyKeep pull_request_target and allow it for that file only. Do not check out PR code
Lints, builds or tests fork codeFork code, no secretsSwitch to pull_request. For fork PRs it runs with a read-only token and no secrets
Posts test or coverage results as a PR commentFork code, then a write tokenSplit: pull_request builds and uploads results as an artifact; workflow_run reads them as data and comments
Runs tests that need a private registry or API keyFork code and a secretRun those tests on push or same-repo PRs, or gate with a maintainer-applied label; opt out of the checkout guard only after review
Runs when a PR is merged (closed + merged check)Merged codeMove it to push on the default branch, which fires on the merge commit
Fixes follow GitHub Docs (Securely using pull_request_target, Events that trigger workflows) and GitHub Security Lab guidance on preventing pwn requests, checked 3 Dec 2026. The last row is Metarix's suggestion, not a GitHub recommendation.

Two of these deserve a closer look. The label-gated pattern is in GitHub Security Lab's pwn request guide, and the same guide warns of a race: an attacker can push new commits after a maintainer adds the label and before the job starts. Treat the label as a speed bump, not a review.

The merge row is easy to miss. GitHub's events reference shows pull_request_target with types: [closed] as the way to run on merge, so plenty of release or changelog jobs use it. In a public repository with no policy, those jobs are now blocked too, even though they never touch fork code.

Step 3: split a results-comment workflow

This is the pattern that replaces most "comment on the PR" uses. The first workflow runs the fork's code with no secrets. The second has a write token but never checks anything out, so no fork code runs in it.

# .github/workflows/pr-test.yml (untrusted, no secrets)
name: PR test
on: pull_request
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: echo "${{ github.event.number }}" > pr_number.txt
- run: make test | tee results.txt
- uses: actions/upload-artifact@v7
if: always()
with:
name: pr-results
path: |
results.txt
pr_number.txt

# .github/workflows/pr-comment.yml (privileged, reads results as data)
name: PR comment
on:
workflow_run:
workflows: ["PR test"]
types: [completed]
permissions:
actions: read
pull-requests: write
jobs:
comment:
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v8
with:
name: pr-results
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}
- run: |
PR=$(tr -cd '0-9' < pr_number.txt)
gh pr comment "$PR" --repo "$GITHUB_REPOSITORY" --body-file results.txt
env:
GH_TOKEN: ${{ github.token }}

The PR number in the artifact comes from the fork, so the second job strips it to digits before use. Security Lab calls that an acceptable risk when the privileged job only comments. Never execute anything from that artifact. The sketch uses upload-artifact v7.0.2 and download-artifact v8.0.2, the latest releases on 3 Dec 2026; adapt the test command to your project.

Step 4: if you must keep it, allow it narrowly

  1. Create an Actions policy at the lowest level that works, usually the repository. Target only the workflow file paths that need the event, not every workflow. GitHub's governance guide supports workflow path targeting for exactly this.
  2. Event rules are an allowlist for the workflows they target. List every event those files use, such as pull_request_target plus workflow_dispatch, so the policy does not refuse the file's other triggers.
  3. Start the policy in Evaluate mode, open a test PR from a fork, and check Policy insights before you switch it to Active.
  4. Set permissions: to the minimum the job needs, and pass only the secrets it uses.
  5. Leave the cache alone. pull_request_target runs get read-only access to the default branch's cache, per the caching reference. Declaring a write-capable cache-mode brings back cache poisoning.
  6. Do not set allow-unsafe-pr-checkout: true unless the checked-out code is only read as data. GitHub notes that npm install or a config file in the PR can run attacker code without any obvious build step.

For the wider secret-handling side, our guide on stopping AI coding agents from leaking secrets covers masking and scanning, and GitHub public monitoring shows what happens after a key does leak. If you plan to refresh old SHA pins, the bot defaults in Renovate vs Dependabot decide how fast those bumps arrive.

Step 5: check it worked

  • A fork PR against a migrated pull_request workflow runs, and its logs show a read-only token.
  • A fork PR against an allowed pull_request_target workflow runs, and any ref: pointing at the PR head fails in checkout unless you opted out.
  • Policy insights shows no unexpected blocked runs over a normal week of PRs.
  • Dependabot or Renovate has a rule for GitHub Actions versions, so SHA pins do not fall behind the next security backport.

Our take

Most repositories should not switch pull_request_target back on. Labeling and greeting bots are the honest exceptions, and they need a policy scoped to one file plus a workflow that never checks out PR code. Everything that builds or tests fork code belongs on pull_request, and anything that must comment back works better split across workflow_run.

This week, an admin should open Policy insights, sort each blocked workflow into a row of the table above, and then check the SHA pins on actions/checkout. That last check is the one most teams will skip, and it is the gap where a narrowly allowed workflow can still run a fork's code with your secrets.

Sources

Tools covered in this guide

Frequently asked questions

Are private repositories affected by the pull_request_target block?
Not by the default policy. GitHub says private and internal repositories are not affected, and neither is GitHub Enterprise Server. The separate actions/checkout guard is not described as public-only, so a guarded checkout release can still refuse a fork checkout in a privileged workflow there.
Can a contributor fix a blocked workflow?
They can change the workflow file, for example moving it to pull_request. Allowing pull_request_target needs an Actions policy, which only repository administrators, organization owners or enterprise owners can create.
Does pinning actions/checkout to a commit SHA keep the old behaviour?
Yes, if the SHA predates the guarded releases. GitHub's June changelog says SHA, minor and patch pins did not receive the 20 July backport. Guarded releases are v7.0.0 and later, v6.1.0, v5.1.0, v4.4.0, v3.7.0 and v2.8.0.
Does the block apply to workflow_run or issue_comment?
The default event policy covers only pull_request_target. The checkout guard also covers workflow_run started by a pull request event, but neither guard covers issue_comment commands or a workflow_run job that runs a downloaded artifact.

More in Tools & workflows

Follow Metarix

Digital media intelligence hub

AI SaaS · developer workflows · architecture

Share