On December 2, 2026, GitHub Actions started blocking pull_request_target by default in affected public repositories, unless an Actions event policy allows it. The date had been moved once from November 2. According to GitHub's changelog, the change covers public repositories on Free, Team and Enterprise Cloud; private and internal repositories are not affected, and an event policy you had already configured still applies.
If you maintain a public repository, the enforcement date has passed, so the useful question is no longer "what is changing" but "what stopped running, and what should replace it". This post is a short audit procedure plus the pattern we use instead.
Why this trigger is dangerous
pull_request workflows triggered from a fork run with a read-only token and no secrets. pull_request_target runs in the context of the base repository: it has the repository's secrets and, by default, a write-capable GITHUB_TOKEN. That is useful for labeling or commenting on fork PRs. It becomes a vulnerability the moment the workflow checks out and executes the PR's code, because untrusted code then runs with trusted credentials.
The classic vulnerable shape looks like this:
on: pull_request_target
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }} # untrusted code
- run: npm ci && npm test # runs with secrets in scopeSeveral supply-chain incidents this year used variations of this pattern, which is the reason for the default change.
Step 1: Find what stopped
Search your workflows for the trigger and check recent runs:
grep -rln "pull_request_target" .github/workflows/
gh run list --workflow=<file>.yml --limit 20Symptoms are typically fork PRs that no longer get labeled, no longer receive a bot comment, or never trigger a preview deployment. Enterprise Cloud users can use evaluate mode and policy insights to see which workflows would have been blocked, but smaller organizations have to rely on the run history above.
Step 2: Classify each workflow
For each hit, ask one question: does the job check out or execute code from the pull request?
- No (labeler, welcome comment, stale-PR bot that only reads metadata): the trigger is legitimate. Allow it with an event policy scoped to that specific workflow file, not the whole repository.
- Yes (build, test, lint, preview deploy): do not allow it. Rework it.
Scoping the policy to individual workflow files matters. A repository-wide allowance recreates the exposure you were just protected from.
Step 3: Split untrusted work from privileged work
For workflows that must both run PR code and then do something privileged (post a coverage comment, upload a preview), use two workflows connected by workflow_run.
The first runs untrusted code with no secrets and produces an artifact:
# .github/workflows/ci.yml
name: ci
on: pull_request
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci && npm test -- --coverage
- uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage/summary.jsonThe second runs from the default branch, has the permissions, and treats the artifact strictly as data:
# .github/workflows/ci-comment.yml
name: ci-comment
on:
workflow_run:
workflows: [ci]
types: [completed]
permissions:
pull-requests: write
actions: read
jobs:
comment:
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: coverage
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Post summary
env:
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
run: |
pct=$(jq -r '.total.lines.pct' summary.json)
gh pr comment "$PR_NUMBER" --body "Line coverage: ${pct}%"Two rules keep this safe. The privileged workflow never checks out or executes anything from the artifact, and it validates what it reads (here, a number extracted with jq and used inside a quoted string, not interpolated into a shell command). Artifact contents are attacker-controlled; treat them like any other user input.
Step 4: Fix the habits around it
- Set
permissions:explicitly at the top of every workflow instead of relying on repository defaults. - Never interpolate
${{ github.event.* }}fields such as PR titles or branch names directly intorun:scripts; pass them throughenv:and quote them. - Pin third-party actions to a full commit SHA in any workflow that has secrets in scope.
- Remove secrets that no longer need to be reachable from fork-triggered workflows, and rotate any that were exposed to a vulnerable workflow in the past.
Our recommendation
The new default is a good forcing function, but an event policy is a patch, not a design. Use it only for metadata-only workflows, scoped by file. For everything that builds or tests contributed code, the two-workflow split is a small amount of extra YAML and removes the whole class of problem. If you maintain several public repositories, a one-hour audit with the three steps above is usually enough to bring them all into line.