GitHub Actions Is Blocking pull_request_target by Default: What to Change Before December 2
- Get link
- X
- Other Apps
GitHub Actions Is Blocking pull_request_target by Default: What to Change Before December 2
GitHub is changing the default security posture of GitHub Actions in public repositories. Starting December 2, 2026, GitHub will block pull_request_target events by default unless an applicable Actions event policy explicitly allows them. Before enforcement, GitHub is using evaluate mode and scheduled brownouts to expose workflows that will be affected.
This is more than a settings change. pull_request_target runs with the base repository's workflow, token, and potentially its secrets. That privilege is useful for trusted automation such as labeling or triage, but it becomes dangerous when the workflow checks out and executes code supplied by an untrusted pull request.
Why this trigger is different
A normal pull_request workflow is designed to process fork contributions with reduced privileges: GitHub uses the pull request's merge commit, gives the job a read-only token by default, and withholds other repository secrets. By contrast, pull_request_target loads the workflow from the base repository's default branch. That lets it use the base repository's permissions and secrets, but it also means the workflow must never execute untrusted pull-request code in that privileged context.
The dangerous pattern is easy to recognize:
on: pull_request_target: jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.sha }} - run: npm ci - run: npm test The checkout step is not the exploit by itself. The problem is what follows it. A fork controls the checked-out package.json, build scripts, test files, Makefile, configuration, and dependencies. Commands such as npm ci or make test can therefore run attacker-controlled code while the job still has privileged access.
First choice: replace it with pull_request
If the workflow only needs to build, test, lint, or scan a contribution and does not need repository secrets or a write-capable token, use pull_request:
name: Test pull requests on: pull_request: permissions: contents: read jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - run: npm ci - run: npm test This is the right migration for most CI. It preserves the pull-request workflow while keeping the untrusted contribution in GitHub's lower-trust execution model. Keep permissions explicit rather than relying on repository defaults, and grant additional permissions only to the job that needs them.
Separate privileged work from untrusted work
Some automation really does need trusted credentials. For example, a workflow may label a pull request, post a status, or publish a report through an authenticated API. That does not automatically mean it should build the pull request's source code.
A safer design separates the responsibilities:
- Run compilation, tests, and other code-executing checks under
pull_requestwith no secrets. - Run a narrowly scoped privileged job only for trusted repository data or a result that has been validated as untrusted input.
- Pass identifiers and structured results between jobs instead of checking out and executing fork code from a privileged workflow.
- Use environment approvals and least-privilege token permissions for deployment or publishing operations.
Be careful with artifacts as well. A privileged workflow_run workflow must treat artifacts from an earlier run as untrusted data; an attacker may be able to influence their contents. Downloading an artifact and executing it recreates the same trust-boundary problem under a different trigger.
If you must keep pull_request_target
There are legitimate uses for the event, but they should be narrow and deliberate. A safe privileged workflow can inspect pull-request metadata without checking out the pull request:
name: Label pull requests on: pull_request_target: types: [opened, synchronize] permissions: pull-requests: write jobs: label: runs-on: ubuntu-latest steps: - name: Apply labels from trusted workflow logic env: GH_TOKEN: ${{ github.token }} PR_NUMBER: ${{ github.event.pull_request.number }} run: | gh pr edit "$PR_NUMBER" --add-label "needs-review" Review every command and action in this workflow. Do not fetch the fork, change repository: to the fork, use ref: ${{ github.event.pull_request.head.sha }}, or execute data derived from the pull request. Keep the token permissions to the smallest required scope and use an ephemeral, isolated runner for any privileged job.
Audit before the deadline
- Search every workflow under
.github/workflowsforpull_request_target,workflow_run, and commands that fetch or check out pull-request code. - For each match, record whether the workflow needs secrets, write access, or only ordinary CI.
- Convert ordinary CI to
pull_requestand set explicit read-only permissions. - For retained privileged workflows, verify that no untrusted source or artifact is executed and that every permission and secret is necessary.
- Review GitHub Actions policy insights while the default policy is in evaluate mode, then test during the November 16 brownout.
GitHub reports that private and internal repositories are not affected by this default policy, and an existing applicable event policy may change how a repository is evaluated. That is not a reason to ignore the audit: the underlying risk exists whenever privileged workflow code executes untrusted content.
The practical rule
Use pull_request to run someone else's code. Use pull_request_target only to run trusted workflow logic that handles pull-request data without executing the contribution. If a workflow needs both untrusted code execution and secrets, redesign the boundary instead of combining them in one privileged job.
References
- GitHub Changelog: pull_request_target blocked by default December 2
- GitHub Docs: Securely using pull_request_target
- GitHub Docs: Secure use reference
- GitHub Docs: Governing execution of GitHub Actions workflows
- GitHub Security Lab: Preventing pwn requests
❤️ Support This Blog
If this post helped you, you can support my writing with a small donation. Thank you for reading.
- Get link
- X
- Other Apps

Comments
Post a Comment