Back to Blog
tutorial9 min readBy GitWatchman Team

pull_request_target Blocked by Default: Fix Your Workflows

Since December 2, 2026, GitHub Actions blocks workflows triggered by pull_request_target in affected public repositories, unless an Actions event policy explicitly allows them (GitHub changelog). If a labeler or a fork test job stopped running this week, the pull_request_target block is the first thing to check.

Who is affected: public repositories on GitHub Free, Team and Enterprise Cloud. Private and internal repositories and GitHub Enterprise Server are out of scope, and an event policy you had already configured still applies. A blocked workflow does not run; during the November test windows GitHub recorded each blocked attempt as a failed run with an error annotation.

Why GitHub Blocked pull_request_target

GitHub announced the change on November 2, moving enforcement from that day to December 2, and ran two brownouts (November 9 and 16, 16:00 to 18:00 UTC) in which the default policy was enforced. Before that the default policy ran in evaluate mode: workflows kept running and the would-be blocks showed up only in Policy insights. The documentation phrases the scope carefully: enforcement applies to "affected repositories that were using the default pull_request_target policy before general availability". The default policy is added only where no applicable event policy exists, and one you already configured keeps applying.

The reason is the trust model. A pull_request workflow on a fork's pull request runs the workflow file from the merge commit with a read-only GITHUB_TOKEN and no other secrets. pull_request_target runs the workflow file from the base repository's default branch and hands it the base repository's token and secrets. That is safe as long as only default-branch code runs. It stops being safe when the workflow checks out the fork's commit and then builds or tests it. GitHub's docs call this a "pwn request" and use this example:

# INSECURE. Example from GitHub's docs.
on:
  pull_request_target:
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          ref: ${{ github.event.pull_request.head.sha }}
      - name: Test
        run: make test

The checkout alone executes nothing. The make test step does: it runs a Makefile written by whoever opened the pull request, with your secrets in the environment. An npm install that triggers a lifecycle script from the fork's package.json does the same thing with less noise.

Find Every Workflow That Uses It

For one repository, GitHub already has the list. Open Settings → Actions → Policies and then Policy insights, which shows runs that were blocked by an active policy or would have been blocked by one in evaluate mode. The same page exists at organization level.

Insights only show workflows that were triggered. A workflow that fires on a rare event, or a repository where no pull request has triggered it yet, won't be there. For a directory of local clones, a text search is quicker: grep -rl pull_request_target */.github/workflows. It also matches comments, though, and the Release Drafter README, for one, ships the trigger commented out. The script below parses each workflow and prints the triggers that run with the base repository's secrets, plus the steps that bring in pull request code. We ran it with Node.js 22 and the yaml package 2.9 against test workflows before publishing.

// node scan-prt.mjs ~/src/*   (Node 22, npm i yaml@2)
import { readFileSync, readdirSync, existsSync } from "node:fs";
import { join } from "node:path";
import { parse } from "yaml";

const PRIVILEGED = ["pull_request_target", "workflow_run", "issue_comment"];
for (const repo of process.argv.slice(2)) {
  const dir = join(repo, ".github/workflows");
  if (!existsSync(dir)) continue;
  for (const file of readdirSync(dir).filter((f) => /\.ya?ml$/.test(f))) {
    const wf = parse(readFileSync(join(dir, file), "utf8")) ?? {};
    const on = wf.on;
    const events = typeof on === "string" ? [on] : Array.isArray(on) ? on : Object.keys(on ?? {});
    const hits = events.filter((e) => PRIVILEGED.includes(e));
    if (!hits.length) continue;
    console.log(`${repo}/${file}: ${hits.join(", ")}`);
    for (const job of Object.values(wf.jobs ?? {})) {
      for (const step of job.steps ?? []) {
        const w = step.with ?? {};
        if (step.uses?.startsWith("actions/checkout") && (w.ref || w.repository))
          console.log(`  ${step.uses} ref=${w.ref ?? "-"} repository=${w.repository ?? "-"}`);
        if (/gh pr checkout|git fetch|download-artifact/.test(step.run ?? step.uses ?? ""))
          console.log(`  fetches code or artifacts: ${(step.run ?? step.uses).split("\n")[0]}`);
      }
    }
  }
}

On our test set it printed this: one workflow that only labels, and two to inspect.

r1/label.yml: pull_request_target
r1/test.yml: pull_request_target
  actions/checkout@v4 ref=${{ github.event.pull_request.head.sha }} repository=-
r2/comment.yml: workflow_run
  fetches code or artifacts: gh pr checkout ${{ github.event.workflow_run.pull_requests[0].number }} && make

The script also lists workflow_run and issue_comment on purpose. Neither is blocked by the new policy, but both run with secrets and GitHub's docs name them as other places where pwn requests happen. The script has blind spots: it does not follow reusable workflows called with jobs.<id>.uses, composite actions, or shell scripts that a run: step calls. Treat an empty result as "nothing obvious", not as an audit.

Labelers Can Stay, Fork Test Jobs Should Move

What you do with each hit depends on one question from GitHub's guidance: is code from the pull request ever executed?

Nothing from the fork runs: keep the trigger, allow it

Labeling and triage bots are the reason pull_request_target exists. The actions/labeler v7.0.0 README uses it in its examples because a pull_request run from a fork gets a read-only token and cannot add labels. The Release Drafter v7.11.0 README suggests the same trigger, commented out, for its autolabeler on fork pull requests. If labels drive the categories in your release notes, a blocked labeler means unlabeled fork contributions in the next draft. These workflows read pull request metadata and run trusted code, so the right move is an explicit allow (section 5) plus a permissions: block that grants only what the job writes.

Fork code runs, no secrets needed: switch to pull_request

GitHub's docs say developers often pick pull_request_target to run a fork's pull request through CI with secrets. If the tests never read a secret, change the trigger to pull_request and drop the custom ref:. By default, actions/checkout in a pull_request run checks out the merge commit, which is what you wanted to test in the first place.

Fork code and secrets: split the workflow

Coverage uploads to a service that needs a token, or a comment posted back on the pull request, are the hard case. The GitHub Security Lab pattern from Preventing pwn requests splits the job: an unprivileged pull_request workflow builds and uploads its results as an artifact, and a privileged workflow_run workflow downloads that artifact into runner.temp (not the workspace) and uses it only as data. The article validates even the pull request number it reads from the artifact. The privileged half must never execute anything it downloaded.

actions/checkout Has Refused Fork Checkouts Since July

The policy blocks the trigger. A second layer has been in place for months, inside actions/checkout itself. Version 7 shipped on June 18 and refuses common pwn request patterns by default. On July 20, 2026 the refusal was backported to every supported major except v1, as v4.4.0, v6.1.0, v5.1.0, v3.7.0 and v2.8.0, each marked "[BREAKING]" in its release notes. Running git ls-remote --tags https://github.com/actions/checkout today shows the floating tags v2 through v6 pointing at those backports. So a workflow that says actions/checkout@v4 picked up the change without anyone editing it, which is how floating tags work (we covered why a tag can move while a release stays put). Workflows pinned to a commit SHA or an exact version did not.

The check lives in src/unsafe-pr-checkout-helper.ts and is narrower than the headline suggests. It runs only for pull_request_target and for workflow_run runs whose triggering event starts with pull_request. It treats a pull request as a fork when the head repository's numeric ID differs from the base repository's. Then it refuses if the repository input names the fork, if ref matches refs/pull/N/head or refs/pull/N/merge, or if the resolved commit is the pull request's head or merge SHA. A plain checkout with no ref and no repository skips the check entirely, because it can only resolve to trusted code.

The opt-out is a step input, allow-unsafe-pr-checkout: true, named so that it stands out in review. What it does not cover, per the same changelog: a run: step that calls git fetch or gh pr checkout, or a checkout of some unrelated third-party repository. The pull_request_target docs add a downloaded artifact from a fork's run to that list.

If you track actions/checkout releases, note that the release marked Latest on the actions/checkout releases page is v7.0.1, published on July 20 next to the five backports, which carry no Latest badge. GitWatchman notifies the Latest release only, so following actions/checkout would have told you about v7.0.1 and nothing about the breaking v4.4.0 that your @v4 workflows were now running. Catching a backport like that means checking the release list or the major tags, not only the Latest release.

Allow It for One Workflow File

In the repository (or organization) settings, go to Actions → Policies, create a policy, set it to Active, target the workflow file, and add an event rule. Event rules are part of what the docs call an allowlist of permitted events, so list every event that file uses and target only that file. GitHub does not document how a one-file policy interacts with the default policy for the repository's other workflows, so check Policy insights after creating it. The same policy through the REST endpoint for repository Actions policies:

cat > policy.json <<'EOF'
{
  "name": "Allow pull_request_target for the labeler",
  "enforcement": "active",
  "conditions": {
    "workflow_path": { "include": [".github/workflows/label.yml"], "exclude": [] }
  },
  "rules": [
    { "type": "restrict_action_events",
      "parameters": { "allowed_events": ["pull_request_target"] } }
  ]
}
EOF
gh api -X POST repos/OWNER/REPO/actions/policies --input policy.json

The body follows the field names in the REST reference and we checked that the JSON parses, but we did not create the policy on a live repository, so read the 422 message carefully if GitHub rejects it. The reference also notes that evaluate enforcement through the API is available only with GitHub Enterprise.

Before allowing the event, apply the hardening steps in the same doc: least-privilege token permissions, only the secrets the job needs, and ephemeral runners. Workflows triggered by pull_request_target already get read-only access to the default branch's cache, so a cache save fails with a warning instead of poisoning later runs. Declaring a write-capable cache-mode undoes that.

What the Default Policy Does Not Stop

The default policy blocks only pull_request_target. An issue_comment workflow that reacts to "/test" by fetching the pull request and running it is just as exposed, and the checkout changelog says its guard does not cover issue_comment either. Neither is command injection, where a pull request title ends up inside a run: script; the Security Lab covers that in its untrusted input guide. And once you add an allow policy, the default policy no longer covers that file. The checkout guard still refuses the common fork checkouts, but if someone edits the workflow next year to fetch the fork with gh pr checkout and run npm test, nothing stops it.

The actions in your workflows are dependencies too. For pinning and monitoring them alongside your libraries, see the guide on GitHub dependency security.

Frequently Asked Questions

Does the pull_request_target block apply to private repositories?

No. GitHub's default policy covers public repositories on GitHub Free, GitHub Team and GitHub Enterprise Cloud. Private and internal repositories are not affected, GitHub Enterprise Server is not included, and an Actions event policy you configured before the change keeps applying instead of the default one.

Why did my labeler workflow stop running on December 2, 2026?

Most likely because it is triggered by pull_request_target, which GitHub now blocks by default in affected public repositories. Check Policy insights under Settings, Actions, Policies. If the workflow only labels pull requests and never runs code from the fork, create an event policy that allows pull_request_target for that workflow file.

Do workflows pinned to an actions/checkout SHA get the fork checkout check?

Only if the pinned commit is v7 or one of the July 20, 2026 backports (v6.1.0, v5.1.0, v4.4.0, v3.7.0, v2.8.0). GitHub says SHA, minor and patch pins are not affected by the backport, so an older pin keeps working and also lacks the protection. The default event policy is separate and applies whatever checkout version you use.

Can I still use pull_request_target in a public repository?

Yes. Create a repository, organization or enterprise Actions policy whose event rule explicitly allows pull_request_target, ideally scoped to the one workflow file that needs it. GitHub asks you to do this only after confirming the workflow never runs pull request code with access to secrets or a privileged token.

Know when the actions you depend on ship a release

GitWatchman checks the Latest release of the public GitHub repositories you follow every 2 hours and alerts you by email, Slack, Discord, Telegram or a personal RSS feed. Free during the beta, up to 5 repositories.

Start tracking releases