Last updated: December 6, 2026
TL;DR: A pwn request happens when a GitHub Actions workflow that runs with secrets also runs code from a stranger's pull request. In 2026 this mistake was the first domino in several npm supply-chain compromises, including TanStack (May 11) and AsyncAPI (July 14). You prevent it by keeping outside code and secrets in separate jobs, preferring the
pull_requesttrigger, locking down caches and OIDC publishing, and using npm 12's install-time defaults as a second line of defence.
I'll be honest: "pwn request" sounds like something you order at a drive-through. It is actually one of the most expensive YAML mistakes in modern software. This guide explains what it is, how attackers chained it into signed malicious npm releases in 2026, and what to change in your own repositories today.
What is a pwn request?
A pwn request is a GitHub Actions workflow that gives untrusted pull-request code access to trusted resources. GitHub's own documentation describes the pattern as the root cause of multiple supply-chain compromises.
The usual culprit is the pull_request_target trigger. Unlike pull_request, it runs in the context of the base repository, so the job receives the base repository's GITHUB_TOKEN and access to repository and organization secrets. That design exists so maintainers can safely label or comment on pull requests. The trouble starts when a workflow also checks out the fork's code and builds or tests it, because the fork's code now runs next to your secrets.
# INSECURE: shown so you can recognise it, not copy it on: pull_request_target: jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.sha }} # fork code! - run: make test # runs it, with secrets in scope GitHub's documentation is careful to say that the checkout alone does not execute anything. The damage happens when the workflow then builds, tests or otherwise runs what it fetched. Pwn requests are also not unique to pull_request_target: any event that runs with secrets can create one if it executes untrusted code.
How did attackers turn this into signed npm malware?
In 2026, attackers chained the pwn request with two other weaknesses: cache poisoning and OIDC token theft. According to Palo Alto Networks Unit 42, the TanStack incident of May 11, 2026 needed no stolen password at all:
- A fork pull request triggered a
pull_request_targetworkflow, which gave fork code execution inside the base repository's runner context. - The fork code wrote a poisoned package-manager cache under the key the release workflow would later restore. Unit 42 notes that
contents: readpermission did not block that cache write. - When the release workflow ran, attacker binaries read the OIDC token from runner memory and used it to publish directly to the npm registry.
A pwn request chain in six steps, and the three places a defender can break it.
The chain in plain words:
| Step | What happens | Who controls it | Where you can break it |
|---|---|---|---|
| 1 | Attacker opens a pull request from a fork | Attacker | Not preventable |
| 2 | pull_request_target starts with base-repo secrets and token | Platform | Use pull_request instead |
| 3 | Workflow checks out and runs fork code | Maintainer's workflow | Never execute fork code in this trigger |
| 4 | Fork code poisons the Actions cache | Attacker | Read-only caches for untrusted triggers |
| 5 | Release workflow restores the poisoned cache | Platform | Save caches only from trusted triggers |
| 6 | OIDC token stolen, malicious versions published | Attacker | Scope trusted publishing narrowly |
The scale was not small. Unit 42 reports that within six minutes, 84 malicious artifacts landed across 42 @tanstack/* packages, and by the end of that day the count had grown to 373 malicious versions across 169 npm packages, with an estimated 520 million cumulative downloads in the affected window. Treat those totals as Unit 42's estimates, not an audited count.
Why did the packages still carry valid provenance?
Provenance attestations prove where a package was built, not whether the build was clean. Unit 42 notes that the compromised Red Hat packages on June 1, 2026 (at least 32 packages under @redhat-cloud-services) carried valid SLSA provenance because the pipeline really did build them. Microsoft reports the same for AsyncAPI: the poisoned versions used npm trusted publishing through GitHub OIDC and carried valid provenance attestations.
So provenance is necessary but not sufficient. A hijacked pipeline produces perfectly signed garbage.
What happened at AsyncAPI on July 14, 2026?
Microsoft Threat Intelligence documented a second variant of the same family. Here is the timeline it describes, all on July 14, 2026:
- A malicious pull request (#2155) against
asyncapi/generatortriggered a docs-preview workflow that usedpull_request_targetand checked out the untrusted commit, with a broadly privileged token and access to secrets. - A credential for the
asyncapi-botaccount was exposed, and later pushes were authenticated as that bot. Microsoft says its write-up does not establish exactly how the credential was obtained. - The legitimate release workflow then published poisoned packages: five versions across four packages, within roughly 90 minutes.
Unit 42 describes the same incident through a different link of the chain, pointing to unprotected next and schema release branches. The two accounts are compatible: a pwn request leaks a token, and weak branch protection lets the attacker push to a branch that publishes.
One detail matters for defenders. Microsoft found that the payload runs at import time and the packages declare no install hooks. Its advice is blunt: do not rely on npm install --ignore-scripts, because that flag does nothing against code that runs when your app imports the package.
What has GitHub changed to stop this?
GitHub spent 2026 closing the hole at the platform level. Wiz's timeline of the changes lists these milestones:
| Date (2026) | Change |
|---|---|
| June 18 | actions/checkout v7.0.0 blocks fork code checkouts by default in pull_request_target and PR-triggered workflow_run |
| June 26 | Read-only cache tokens for untrusted triggers, to prevent cache poisoning |
| July 20 | Checkout protections backported to v2.8.0, v3.7.0, v4.4.0, v5.1.0 and v6.1.0 |
| September 17 | Workflow Execution Protections reach general availability; the default event policy starts in evaluate mode |
| December 2 (scheduled) | Default policy blocks pull_request_target in public repositories without an explicit event policy; private and internal repositories are unaffected |
GitHub's documentation confirms that December 2, 2026 enforcement date for affected public repositories. I could not confirm from the documentation copy I read whether enforcement has reached every repository, so check your own repository's Actions policy insights rather than assuming.
These changes help, but they are not a cure. Wiz lists what still works against a hardened platform:
- Old SHA pins. Pinning
actions/checkoutto a commit from before July 20 runs legacy code with no protection. Pinning is good advice, but it has to point at a patched release. - Fetching code another way. A custom
git clone,gh pr checkoutor a downloaded artifact is not covered by checkout's protections. - The
workflow_runartifact chain. An unprivileged build uploads an artifact that a privileged workflow downloads and executes. - Script injection. Interpolating
${{ github.event.pull_request.title }}straight into a shell command executes attacker text with no checkout at all.
Also, one common misconception: the "Require approval for external contributors" setting does not gate pull_request_target.
How do I fix my workflows?
Start with the rule that fits on a sticky note: code from outsiders and secrets must never share a job.
The unsafe single workflow on the left, and the split pattern on the right.
Here is the safer shape. The first job has no secrets and a read-only token:
# Untrusted zone: runs fork code, holds nothing valuable on: pull_request permissions: contents: read jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@<sha-of-a-patched-release> # pin to a SHA at or above the patched versions - run: make test Anything that needs secrets runs in a separate, trusted workflow that treats whatever came from the first one as data, never as something to execute, and sits behind an environment with required reviewers. GitHub's guidance adds that if you must keep pull_request_target, you should restrict secrets, keep token permissions to the minimum, save caches only from a trusted trigger such as push, and isolate self-hosted runners.
To close the script-injection gap, pass event values through an environment variable instead of interpolating them into the command:
- name: Safe handling of a PR title env: PR_TITLE: ${{ github.event.pull_request.title }} run: echo "$PR_TITLE" How do I limit the damage if a pipeline is compromised?
Assume one layer will fail and stack the others. Unit 42's recommendations, together with GitHub's npm announcements, add up to four layers:
Defence in depth: each layer assumes the one before it can fail.
Layer 1, CI. Prefer pull_request over pull_request_target, keep GITHUB_TOKEN permissions minimal, use ephemeral runners for untrusted triggers, and audit workflows with zizmor and CodeQL for GitHub Actions.
Layer 2, publishing. Scope OIDC trusted publishing to one specific workflow on a protected branch, and protect every branch that can trigger a release. GitHub also announced on July 8, 2026 that npm granular access tokens that bypass 2FA will lose the ability to publish directly in a second phase planned for January 2027, leaving staged publishing with a human approval step. GitHub's changelog and The Hacker News report that GitHub tells maintainers to plan their migration to trusted or staged publishing.
Layer 3, install time. npm 12, released July 8, 2026, turns three automatic behaviours into opt-in ones: dependency lifecycle scripts (allowScripts is off by default), Git dependencies and remote-URL dependencies. One developer quoted by ReversingLabs said the change will "stop feeding the worms". To prepare, run npm approve-scripts --allow-scripts-pending, review the list, and commit the resulting allowlist in package.json. Use npm ci with a lockfile in CI, and consider a release-age cooldown (Microsoft points to the min-release-age setting; Unit 42 suggests a 24 to 72 hour delay via a registry proxy). Remember the AsyncAPI lesson: import-time payloads ignore install-script settings.
Layer 4, response. Restrict CI runner egress to known registries, generate an SBOM for each release so impact analysis is fast, and rotate npm, GitHub, cloud, SSH and CI/CD credentials from a clean machine after any possible exposure.
Try it yourself: audit your own repositories
Run these in a repository you own, ideally a throwaway one first.
# 1. Find privileged triggers grep -RIn "pull_request_target" .github/workflows/ # 2. Find places that fetch PR code grep -RInE "pull_request\.head\.(sha|ref)|refs/pull/|gh pr checkout" .github/workflows/ # 3. Run a static analyser for Actions workflows pipx run zizmor .github/workflows/ # 4. See which dependency scripts npm 12 would block npm approve-scripts --allow-scripts-pending For a hands-on lab, create a test repository with a harmless workflow that prints secrets.MY_TEST_SECRET as a masked value on pull_request. Open a pull request from a second account's fork and observe that the secret is empty for fork runs. Then read your repository's Actions policy page to see whether pull_request_target is blocked or in evaluate mode. Never test with real secrets or against repositories you do not own.
FAQ
What is the difference between pull_request and pull_request_target?
pull_request runs the PR's code with limited permissions and no secrets for forks. pull_request_target runs the base repository's workflow with its token and secrets, which is why it must never execute fork code.
Does pinning actions to a commit SHA protect me?
Only if the SHA is at or above a patched release. Per Wiz, a pin to a pre-July 20 checkout release runs legacy code without the new protections.
Does npm install --ignore-scripts stop these attacks?
Not all of them. Microsoft found the AsyncAPI payload ran at import time and used no install hooks, so the flag did not apply.
Are provenance attestations a guarantee that a package is safe?
No. They show where a package was built. In both the Red Hat and AsyncAPI cases the malicious versions carried valid provenance because a compromised pipeline built them.
Does the December 2 GitHub policy fix this for me?
It reduces exposure for public repositories without an explicit event policy, but it does not cover private repositories or the residual paths above, such as script injection and the artifact chain.
Key takeaways
- A pwn request is untrusted code running next to trusted secrets;
pull_request_targetplus a fork checkout is the classic form. - In 2026 attackers chained it with cache poisoning and OIDC token theft to publish signed malicious npm versions (TanStack, May 11) and via exposed bot credentials (AsyncAPI, July 14).
- Platform fixes landed between June and December 2026, but old SHA pins, custom fetches, artifact chains and script injection remain.
- Split trust zones, narrow your publishing identity, and treat npm 12's defaults as one layer among four.
Further reading
- Securely using pull_request_target (GitHub Docs)
- Preventing pwn requests (GitHub Security Lab)
- The Pwn Request Reckoning (Wiz)
Sources
- Microsoft Security Blog: Unpacking the AsyncAPI npm supply chain compromise (July 15, 2026)
- Palo Alto Networks Unit 42: Monitoring npm supply chain attacks
- GitHub Docs: Securely using pull_request_target
- Wiz: The Pwn Request Reckoning
- GitHub Changelog: npm install-time security and GAT bypass2fa deprecation (July 8, 2026)
- The Hacker News: npm 12 disables install scripts by default
- Socket: npm v12 ships with install scripts off by default
- ReversingLabs: npm v12 blocks install scripts
Written by Ahmed Eleuch, more at https://ahmedeleuch.dev


