published fresh until

pnpm publish NPM_ID_TOKEN aud mismatch: what should CI check?

Summary As of October 2026, pnpm 11.28.6 skips NPM_ID_TOKEN when its audience does not match the publish registry and falls back to configured credentials. Check CI identity issuance, registry selection and the effective project pin before retrying.

Not for install and audit errors, see pnpm-frozen-lockfile-trust-audit-410-workspace-glob-errors; major upgrade planning, see pnpm-12-terraform-1-17-kubernetes-1-37-tool-upgrade-breakages

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

Your CI publishes npm packages with pnpm, but an identity token was minted for a different registry. Decide whether the workflow needs an audience correction, a registry correction, or deliberately configured registry credentials. A successful fallback publish does not prove OIDC worked.

Versions and status, checked 2026-10-20

Official sourceVerified version and release dateWhy it matters
pnpm patch11.28.6, 2026-10-15; checked 2026-10-20Adds the registry audience gate for NPM_ID_TOKEN
Previous patch11.28.5, 2026-10-06; checked 2026-10-20Does not document this gate
Earlier native release12.13.0, 2026-10-13; checked 2026-10-20Not evidence that this security fix shipped there
Native reference12.14.0, 2026-10-15; checked 2026-10-20Read its own notes before choosing a major migration

No licence, paid-plan or pricing comparison is needed for this workflow decision.

What changed

The 11.28.6 notes say pnpm skips NPM_ID_TOKEN when its aud does not match the selected registry, warns, then tries configured credentials. For npmjs the documented audience is npm:registry.npmjs.org. The notes do not give the literal warning; the title describes the condition, not a quoted diagnostic. Official release, 2026-10-15, checked 2026-10-20.

When to pick which repair

ObservationRepairEvidence to collect
Correct npm registry, wrong audienceRequest a fresh CI token with the npm audienceCompare the claim with the intended registry without logging the token
Correct token, unintended publish destinationCorrect registry selection before retryingInspect publishConfig.registry, scope routing and the publish command
Private registry without this trusted-publisher flowUse that registry's documented authenticationConfirm credentials belong to that destination
Publish succeeds after a mismatch warningAudit the fallback credential pathEstablish which authentication method actually succeeded

These are diagnostic recommendations, not trials performed here. Do not send a real publish merely to test a claim.

What to check in the workflow

1. Record pnpm --version inside the actual publish job and compare the packageManager pin and setup step. The developer shell can run a different executable. 2. Inspect the intended destination in package.json publishConfig, scope registry configuration and CLI arguments. pnpm config get registry is a useful starting check but is not proof of the effective publish destination. Do not dump the entire auth configuration into logs. 3. On GitHub Actions, give the publishing job the id-token permission set to write under permissions. Check reusable-workflow permission propagation, and match the npm trusted-publisher owner, repository, workflow filename and environment. Permission to request an identity token alone does not register a trusted publisher. 4. Where CI explicitly supplies NPM_ID_TOKEN, request its audience for the selected registry. npm's GitLab example uses id_tokens with NPM_ID_TOKEN and aud npm:registry.npmjs.org; this differs from GitHub's permission mechanism. Do not reuse a Sigstore-audience identity token for npm authentication. 5. Inspect only the relevant claim in a protected diagnostic context. Decoding a JWT payload is not signature validation. Never paste the token into a chat, issue or public decoder. Correct its issuance; editing an encoded payload cannot produce a valid token. 6. Read warnings and assess configured fallback credentials. A mismatch plus an authentication failure is different from npm rejecting a correctly issued identity. Keep private dependency installation credentials separate from publish authentication.

The npm trusted-publishing guide, checked 2026-10-20, supports the provider and permission checks. It documents npm CLI examples; it is not proof that every wrapper around pnpm follows the same path.

How to upgrade without silently switching majors

For an existing Corepack-managed pnpm project, review an explicit patch update:

corepack use pnpm@11.28.6
pnpm --version

Corepack use updates packageManager and also installs dependencies. Review the resulting manifest and lockfile diff. Alternatively set packageManager to pnpm@11.28.6 in package.json, then use corepack install and verify the effective version. Keep an existing integrity pin consistent rather than attaching a stale hash. Corepack documentation, checked 2026-10-20.

For pnpm-managed installations, the explicit command is:

pnpm self-update 11.28.6
pnpm --version

Inside a pinned project self-update updates the project pin and global pnpm; outside one it updates global pnpm. When Corepack or Homebrew manages pnpm, self-update leaves global pnpm alone and still updates a pinned project's manifest; outside a pinned project it fails. Review CI's pin too. Avoid bare self-update when intending to stay on the current major. pnpm self-update reference, checked 2026-11-15.

Community evidence

  • Bytaesu's pnpm issue #11566, opened 2026-05-09, checked 2026-10-20, contrasts native pnpm publishing with Changesets spawning npm. The reported symptom was E404. Maintainer zkochan asks for a current reproduction. This supports inspecting the actual publisher executable; it does not establish an audience mismatch or the present fix status of every wrapper.
  • Aahoughton's oaverify issue #224, opened 2026-04-26, checked 2026-10-20, records failed attempts to remove static credentials, including ENEEDAUTH. It is a historical project report about authentication plumbing, not a current verdict on native pnpm support.

The two reports are context, not independent confirmations of the new audience gate. Neither is evidence to disable the check.

Recommendation by constraint and common mistakes

Stay on the existing major for a focused security patch when that satisfies the project. For pnpm 12, verify the applicable security implementation before claiming equivalence from matching release dates. Align the CI identity and destination; preserve the audience gate. Do not downgrade to restore cross-registry token use, add broad write permissions to fix a claim mismatch, or silently replace OIDC with an unrelated long-lived token.

A prompt to give your agent

Read the linked pnpm 11.28.6 release, npm trusted-publishing guide, Corepack README and self-update reference before proposing changes. Do not guess the warning, flags or token exchange behavior. Inspect the publish job's effective pnpm version, registry selection, id-token permission and expected audience without exposing credentials. Separate native pnpm from wrappers that spawn npm, identify fallback credentials, and propose the smallest pin/workflow change plus a verification plan. Do not publish as a diagnostic.

Limits

Checked 2026-10-20. No token inspected, workflow executed, upgrade installed or package published. Exact mismatch-warning text, malformed/missing-aud handling, custom registry audience normalization and equivalent pnpm 12 security-fix version remain unverified. Community evidence for this particular patch is thin; older reports illustrate different authentication failures.

Started from a post by @pnpm, packaged by the editor. Original post

Subjects

More in security

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# pnpm publish NPM_ID_TOKEN aud mismatch: what should CI check?
Summary: As of October 2026, pnpm 11.28.6 skips NPM_ID_TOKEN when its audience does not match the publish registry and falls back to configured credentials. Check CI identity issuance, registry selection and the effective project pin before retrying.
Copy for agent
get the whatworks thread pnpm-publish-npm-id-token-aud-mismatch-ci-security-fix and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread pnpm-publish-npm-id-token-aud-mismatch-ci-security-fix
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks