Linux & DevOps Ubuntu 24.04 LTS

Fix GitHub pull_request_target Before the Dec 2, 2026 Default Block

GitHub enforces a default block on pull_request_target in public repositories starting December 2, 2026. Learn how to audit workflows on Linux with zizmor and gh api, migrate to pull_request or workflow_run, and scope explicit event policies safely.
Z
Zaisha
Staff Writer · Verified Editor
Published Nov 30, 2026 · 7 min read · 1,318 words
Quick Overview

This deep-dive covers github pull_request_target default block with actionable analysis, practical implications, and expert insights.

Fix GitHub pull_request_target Before the Dec 2, 2026 Default Block
Isolating untrusted fork pull request workflows from protected CI secrets and base repository tokens.

Quick answer: Starting December 2, 2026, GitHub Actions blocks pull_request_target events by default in all public repositories hosted on GitHub Free, Team, and Enterprise Cloud unless an Actions event policy explicitly allows them. Before enforcement hits, audit your .github/workflows YAML files on Linux with rg, zizmor, and gh api, move non-privileged CI checks to pull_request, split privileged commenting into hardened workflow_run jobs, and scope explicit event policies strictly by workflow file path.

Why GitHub Is Blocking pull_request_target by Default

GitHub originally scheduled this default protection for November 2, 2026, postponed enforcement to December 2, 2026, and ran two live brownout windows on November 9 and November 16, 2026 from 16:00 to 18:00 UTC. Between those windows, the default rule runs in evaluate mode so maintainers can spot impacted workflows inside Policy insights before runs start failing with error annotations. Private repositories, internal repositories, and GitHub Enterprise Server instances are unaffected.

The core issue is trust boundary confusion. A standard pull_request trigger runs the workflow definition from the pull request merge commit, strips repository secrets, issues a read-only GITHUB_TOKEN, and enforces fork approval rules. By contrast, pull_request_target runs the workflow definition from the base repository default branch with full access to repository secrets and a potentially writable GITHUB_TOKEN.

Trigger EventWorkflow SourceSecrets AccessDefault Cache ScopePrimary Risk
pull_requestPR merge commitWithheld for forksRead-only from baseSafe default for untrusted fork tests
pull_request_targetBase default branchAvailableRead-only from basePwn request if fork code is checked out and run
workflow_runBase default branchAvailableBase branch scopeExecuting poisoned artifacts from fork jobs

Because pull_request_target grants elevated credentials, checking out a contributor fork head and running make test, npm install, or any project config file turns an ordinary pull request into remote code execution inside your pipeline. GitHub Security Lab classifies this pattern as a pwn request. To keep credentials safe on the developer workstation side as well, read our guide on sandboxing local MCP servers on Linux with systemd.

Step 1: Audit Local Workflows on Linux With Ripgrep and zizmor

Start inside a local clone on Ubuntu or any Linux workstation by locating every workflow referencing privileged triggers or pull request head references. Fast pattern matching catches obvious targets in seconds:

rg -n "pull_request_target|issue_comment|workflow_run|pull_request\.head\." .github/workflows/

Next, run zizmor, an offline-native Rust static analyzer built specifically for GitHub Actions, Dependabot, and workflow injection audits. Install it via Cargo or Linuxbrew and run an auditor-level scan across your repository:

cargo install --locked zizmor
zizmor --version
zizmor --persona=auditor .github/workflows/

If you want machine-readable findings for Code Scanning or a pull request checklist, emit SARIF output directly from your Linux terminal:

zizmor --format sarif . > zizmor-results.sarif

Pay special attention to three anti-patterns flagged during static analysis:

  • Explicit PR head checkouts: Any actions/checkout step setting ref: ${{ github.event.pull_request.head.sha }}, refs/pull/${{ github.event.pull_request.number }}/merge, or repository: ${{ github.event.pull_request.head.repo.full_name }} under pull_request_target.
  • Out-of-band fetches: Shell steps executing git fetch or gh pr checkout followed by build scripts, linters, or package managers.
  • Expression injection: Direct interpolation of ${{ github.event.pull_request.title }}, head.ref, or comment bodies inside run: shell blocks instead of passing them through safe environment variables.

Step 2: Query Token Permissions and Execution Policies With gh CLI

Even if your repository uses clean triggers, older GitHub organizations created before February 2, 2023 often retain read-write defaults for GITHUB_TOKEN. Verify both your token defaults and workflow execution policies through the REST API using the GitHub CLI:

gh api /orgs/YOUR_ORG/actions/permissions/workflow
gh api /repos/OWNER/REPO/actions/permissions/workflow

Confirm that default_workflow_permissions returns read and can_approve_pull_request_reviews returns false. Then inspect active or evaluating Actions execution policies at the repository or organization level using the 2026-03-10 API version header:

gh api /repos/OWNER/REPO/actions/policies \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2026-03-10"

gh api /orgs/YOUR_ORG/actions/policies \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2026-03-10"

In the GitHub web UI, navigate to Settings > Actions > Policies > Policy insights to view every recent run that would have been blocked once the December 2 default rule flips from evaluate to active enforcement. Whenever you rotate tokens or investigate suspicious CI exposure, review our checklist on securing API tokens and developer data on Linux.

Step 3: Migrate Non-Secret Workflows to pull_request

Most workflows using pull_request_target do not actually need repository secrets. Unit tests, formatting checks, container builds, and static linters belong on pull_request with explicit least-privilege permissions:

name: Safe PR Verification
on:
  pull_request:
    branches: [main]

permissions: {}

jobs:
  test:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@v6
      - name: Run unit tests
        run: make test

Setting permissions: {} at the workflow root revokes all default scopes, forcing each job to request only what it strictly requires. Upgrading to actions/checkout@v6 or pinning to a full-length 40-character commit SHA also keeps credentials out of the local .git/config directory by storing them under $RUNNER_TEMP, neutralizing ArtiPACKED-style artifact token leaks. If you manage self-hosted Linux runners for heavier workloads, lock down the host environment with systemd service hardening or isolate builds inside rootless Podman containers on Linux.

Step 4: Split Privileged Labeling or Commenting With workflow_run

When a pipeline genuinely needs to run untrusted fork tests and post a privileged PR comment or coverage badge, split the workflow into two stages. Stage 1 runs on pull_request with zero secrets, computes the result, and uploads a plain JSON or text artifact alongside the PR number.

Stage 2 triggers on workflow_run in the base repository context, downloads the artifact, validates its schema as untrusted data, and never executes code or scripts contained inside it:

name: Post PR Coverage Comment
on:
  workflow_run:
    workflows: ["Safe PR Verification"]
    types: [completed]

permissions: {}

jobs:
  comment:
    if: ${{ github.event.workflow_run.conclusion == 'success' }}
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
    steps:
      - name: Download untrusted artifact
        uses: actions/download-artifact@v4
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          run-id: ${{ github.event.workflow_run.id }}
          path: pr-metrics
      - name: Validate and post comment
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          python3 -c 'import json; data=json.load(open("pr-metrics/summary.json")); assert isinstance(data["coverage"], (int, float))'

Never run npm, make, or shell scripts extracted from the artifact directory. Treat every uploaded file as untrusted user input.

Step 5: Allow-List Required Workflows Without Blanket Exceptions

Some metadata workflows, such as auto-labeling external PRs or checking linked issues without checking out fork code, genuinely require pull_request_target. Rather than creating an organization-wide exception that re-opens every public repository to risk, configure an Actions event policy scoped specifically by workflow_path (for example, .github/workflows/labeler.yml).

Pair that scoped policy with two modern 2026 platform controls:

  • Workflow dependency lockfiles: GitHub Actions lockfiles lock both direct and transitive step-level action dependencies, closing tag-repointing attacks like the tj-actions/changed-files compromise.
  • Read-only default branch cache: Leave the default read-only cache scope intact on pull_request_target jobs so untrusted pull requests cannot poison shared build caches.

Troubleshooting Common Dec 2 Migration Errors

  1. Workflows fail immediately on December 2 with an event policy error annotation: Check Settings > Actions > Policies > Policy insights to confirm whether the default block hit an unmigrated trigger, then either switch the YAML to pull_request or add a targeted workflow_path allow rule.
  2. Cache save steps log permission warnings in pull_request_target runs: This is intentional platform behavior to prevent cache poisoning. Populate caches from a trusted push workflow on your default branch instead of enabling a write-capable cache-mode.
  3. actions/checkout blocks a fork ref checkout: GitHub added built-in actions/checkout guards against unsafe PR checkouts. Although allow-unsafe-pr-checkout: true exists as an explicit opt-out for pure static inspection, audit your steps with zizmor first and prefer a two-stage pull_request plus workflow_run design whenever feasible.
Tested & Verified Environment
Operating System: Ubuntu 24.04 LTS
Testing Methodology & Notes: Verified GitHub Changelog (Nov 2, 2026), GitHub Actions execution protection policy API headers (2026-03-10), zizmor CLI flags (--persona=auditor, --format sarif), and workflow migration patterns.

Was this technical analysis helpful?

Your feedback informs our benchmark updates and ongoing article audits.

✓ Thank you for your feedback! Our editorial engineers review submissions weekly.

Frequently Asked Questions

Structured for search engines and AI answer systems (AEO/GEO).

No. The default workflow execution policy blocking pull_request_target applies only to public repositories on GitHub Free, GitHub Team, and GitHub Enterprise Cloud. Private repositories, internal repositories, and GitHub Enterprise Server are unaffected.

Open Settings, Actions, Policies at the repository, organization, or enterprise level and create an Actions event policy that explicitly allows pull_request_target scoped via workflow_path to only the specific YAML files that require it.

Run untrusted builds and unit tests under the standard pull_request trigger with permissions set to empty, upload numeric or JSON results as an artifact, and use a separate workflow_run workflow to post PR comments after validating the artifact strictly as data.

Search .github/workflows with ripgrep for pull_request_target and pull_request.head references, run zizmor --persona=auditor .github/workflows/ to detect checkout and expression injection flaws, and check Policy insights via Settings or gh api.

More answers in our FAQ hub.

Z
Zaisha

Tech journalist covering AI, software, and emerging technology with a focus on practical insights.

Testing Standards: Tutorials and guides are hands-on tested on Ubuntu Linux workstations before release.
View all articles by Zaisha

Practical Linux & Applied AI Newsletter

Get new tested tutorials and benchmark comparisons delivered directly to your inbox. Zero spam.

Join Weekly guides readers getting our weekly digest.

  • Practical Linux administration & terminal workflows
  • Tested open-source AI setups & benchmarks
  • Zero spam - unsubscribe anytime

Join Weekly guides readers · Weekly digest · Unsubscribe anytime. RSS

Continue Exploring