Blog · AppSec

Trusted publishing moved the npm secret into an identity boundary

PentStark TeamNovember 5, 20268 min read
Abstract circuit-trace cover in violet and cyan on a dark navy background

npm trusted publishing removes a long-lived secret from your release pipeline, and that is a real improvement. But it does not remove trust; it moves it. The publish credential is now minted from a workflow identity, so the security of a release depends on what can run inside that workflow and on whether the identity binding on the registry side stays attached to the right repository. Two 2026 events, the ChainDrop worm and the SlugFest binding flaw, probe those two halves separately, and a pentest of a release pipeline should treat both as in scope.

TL;DR

  • Trusted publishing replaces a stored npm token with a short-lived credential exchanged for a CI OpenID Connect (OIDC) token. The trust anchor becomes the repository and workflow named in the binding.
  • SlugFest, reported by Bloom Security, showed that the binding was keyed on the repository name rather than its permanent ID until the first successful publish. GitHub's fix is to expire unvalidated bindings after 48 hours.
  • ChainDrop, analysed by Microsoft and Unit 42, contained a code path built to republish through a trusted-publisher workflow. Unit 42 did not observe that path run and says it was gated to one specific repository and workflow.
  • Provenance tells you where a tarball was built. npm's own documentation says it does not guarantee the absence of malicious code.
  • For testers: scope the publishing workflow, its runner, its triggers and the repository's rename, transfer and deletion lifecycle.

What changed when the token went away

Until recently, a typical npm release job held a publish token as a CI secret. Steal the token and you could publish. The plan GitHub set out in September 2025, after the earlier Shai-Hulud worm, described a future in which publishing options narrow to local publishing with two-factor authentication, granular tokens limited to seven days, and trusted publishing. It gave no dates for these changes.

Trusted publishing, as npm documents it, has the registry accept a publish from a named workflow instead of a token. You configure the organisation or user, the repository, the workflow filename and optionally a GitHub environment. The workflow needs the id-token: write permission to request an OIDC token from GitHub. GitHub's OIDC reference lists the claims in that token, including repository, repository_id, repository_owner_id, job_workflow_ref and event_name. Those claims are what a registry can bind to.

That design is sound. The question for a security team is what the new trust anchor is exposed to. There are two answers: the binding, and the runner.

Half one: the binding (SlugFest)

According to Bloom Security's write-up, npm's trusted-publishing configuration sent only the repository slug (owner and name), the workflow filename and an optional environment. The numeric repository and owner IDs present in GitHub's OIDC tokens were not stored until a package's first successful publish. If a maintainer renamed, transferred or deleted the bound repository before that first publish, someone else could create a repository at the freed slug, run a publish workflow there and obtain a publish credential for the victim's package.

Bloom reports that it demonstrated this end to end against an npm scope and GitHub repositories it owns, and that a scan found more than 1,500 packages in the vulnerable state, with more than 10 million downloads combined. Neither Bloom nor The Hacker News coverage states that any package was hijacked in the wild. Bloom says it did block customer AI agents from downloading some of the exposed packages. Bloom also reports a long disclosure timeline: report on June 6, 2026, with a fix it describes as taking more than 120 days. We have only Bloom's account of that timeline.

The remedy is in GitHub's changelog of October 2, 2026. Trusted-publishing configurations that have never validated now expire 48 hours after creation, validation happens on the first successful publish, and changing the repository or project identity starts a new window. The same entry says npm now rejects trusted-publishing tokens from issue_comment events, alongside the existing pull_request_target restriction. The npm documentation describes the same first-publish binding to the repository's immutable identity, and states a two-day window.

The lesson is about lifecycle, not just this bug. A trust relationship anchored to a name inherits every way a name can change hands. Anything that binds identity to a mutable label deserves the same scrutiny.

Half two: the runner (ChainDrop)

Microsoft's analysis describes ChainDrop as a credential-stealing, self-propagating worm in more than 400 compromised npm packages from multiple publishers. A malicious release adds a preinstall script. The payload checks whether it is on a developer machine or in CI, and in CI it stays attached to reach job secrets, runner credentials and OIDC publishing permissions. Using stolen npm tokens it republishes every package the identity can reach, and Microsoft says many malicious versions had no matching source commit, pull request or tag. Microsoft states that evidence points towards stolen maintainer credentials as the initial vector and does not say how they were stolen.

For this post the important part is the OIDC branch. Microsoft says the payload has a path that republishes through a GitHub Actions workflow configured as an npm trusted publisher, and that such packages can carry valid provenance. Unit 42's analysis adds precision that matters for accuracy: the OIDC-to-npm path they examined only runs when the repository and workflow match one specific open-source project's release workflow, and they write that they did not observe it execute. The same analysis describes a helper that reads the memory of the GitHub runner worker process to look for OIDC tokens and secrets, and a Sigstore signing step that produces an accurate attestation of the workflow that ran. Unit 42's summary of the provenance point is that valid provenance is what you should expect when attacker code runs inside the named workflow.

So the supportable claim is narrower than "the worm abused trusted publishing everywhere." It is that malware written for CI knows where the OIDC token lives and how to exchange it, and that the registry-side check cannot tell a legitimate release step from attacker code running in the same job.

Provenance is not a verdict

This is where many teams over-read the signal. npm's provenance documentation says provenance establishes where a package was built and who published it, and that it does not guarantee the package has no malicious code. The SLSA build track is similarly about the build: Build L2 addresses tampering after the build, and Build L3 addresses tampering during it by requiring a hardened platform that keeps signing secrets away from user-defined build steps. Note that this page is for SLSA v1.0, which the project marks as retired in favour of v1.2; we did not read v1.2.

Provenance is therefore good evidence for questions like "did this tarball come from the workflow I expect," and weak evidence for "is this tarball safe." Treat a valid attestation as the start of an investigation: check the workflow identity inside it, and whether the source commit exists.

Where the runner is exposed

GitHub's own security guidance is explicit about the ingredients. A compromised third-party action has access to the secrets configured for the repository. Untrusted input in expressions can lead to script injection, and the recommended mitigation is passing values through intermediate environment variables. Privileged triggers such as pull_request_target and workflow_run must not check out untrusted code. GitHub-hosted runners are ephemeral isolated virtual machines, while self-hosted runners lack that guarantee and can be persistently compromised. The npm trusted-publishers page lists GitHub-hosted runners as supported and self-hosted runners as not supported.

ChainDrop also left files designed to re-execute through developer tooling: Unit 42 lists a SessionStart hook in .claude/settings.json and a .vscode/tasks.json task that runs on folder open. Unit 42 notes that only the VS Code path reached a payload in the samples it analysed. These files matter here because a pipeline compromise can start on a laptop.

What a pentest of the release path should cover

  1. Enumerate every workflow that holds id-token: write, and every trigger that can reach it. Confirm untrusted pull-request input cannot reach those jobs.
  2. Review actions used in publishing jobs: pinned by commit, maintained, and given the least permissions.
  3. For each trusted-publisher binding, check it has completed a first publish, and walk through what happens on repository rename, transfer, archival and deletion.
  4. Check runner type, egress filtering and whether lifecycle scripts run in the publishing job at all.
  5. Look for auto-executing configuration in repositories: editor tasks, assistant hooks, and workflows added by recent commits.
  6. Verify that publishing access disallows tokens where trusted publishing is in use, as the npm documentation recommends.

None of this involves exploiting anything. It is configuration and trust review, plus a read of recent workflow changes.

The PentStark view

This section is opinion. We think the industry is slightly too eager to read "no long-lived secret" as "solved." Removing the token was the right move, and the 48-hour expiry shows the ecosystem can tighten fast once a gap is understood. But the two events point at the same pattern: trust anchored to something an attacker can reach, whether that is a freed name or a runner process. We would rank workflow-level controls above provenance checks in a release-security review, because provenance records what the pipeline did, not whether the pipeline was trustworthy. We hold this view with uncertainty: ChainDrop's OIDC path was not observed running, and SlugFest has no reported in-the-wild hijack, so the evidence is about exposure, not confirmed loss. For methodology background, see our methodology page.

References

Last verified: 2026-11-05

Talk to an operator

Your next finding is one scoping call away.

Thirty minutes with a real operator tells us what you need and what we can deliver. No BDR handoff, no sales engineer theater. The person you talk to is the person who scopes the work.

● Responses in < 1 business day