Security

How to Audit npm Trusted Publisher Bindings After SlugFest (2026)

SlugFest let attackers inherit npm publish trust by claiming a freed GitHub repo name. Here is how to audit your bindings and lock down the workflow that publishes.

Marcus Oyelaran

Security & DevOps Specialist

Published 8 min read
Computer security concept image representing protection of a software publishing pipeline
On this page 7 sections

To audit npm trusted publisher bindings after SlugFest, open each package's trusted publishing settings and check that the listed GitHub owner and repository still belong to you. Delete any binding that points at a renamed, transferred, or deleted repo. Recreate it, then complete a first successful publish within two days to validate it.

In October 2026, researchers showed that npm's trusted publishing could be hijacked without stealing a single credential. The attack, named SlugFest, put more than 1,500 packages at risk. Backtrace covers security problems that keep resurfacing in real codebases, and this one lives in a setting many teams configured once and forgot.

This guide is for maintainers and release engineers who publish to npm from CI. It explains the flaw, walks through the audit, and shows how to harden the workflow that does the publishing.

What Is the SlugFest Flaw in npm Trusted Publishing?

SlugFest is a flaw in how npm matched a publisher to a GitHub repository. Before a package's first publish from that repository, npm checked the name (the owner/repository slug) and ignored the permanent numeric ID. If a slug was freed, anyone could claim it and inherit the trust.

Door lock and keys, a picture of trust tied to an address instead of an owner

Researchers at Bloom Security reported the problem to GitHub on June 6, 2026, according to The Hacker News coverage of GitHub's response. One researcher compared it to a lock that checks the address on the door instead of who owns the house. When the owner moves out, whoever moves in gets the key.

Trusted publishing arrived in npm in July 2025 as a credential-free way to publish from CI. The CI provider mints a short-lived OpenID Connect (OIDC) token for one workflow run, and npm checks it against a pre-authorized configuration. It removes long-lived secrets and adds provenance attestations, which is why the flaw stung: the safer system had a soft spot in its first step.

The attack needs no stolen secrets. It follows four steps:

  1. The attacker creates a repository at the freed owner/repository path, and GitHub issues a fresh repository ID.
  2. The attacker triggers a publish workflow, which mints an OIDC token carrying the reclaimed slug.
  3. The token goes to npm's exchange endpoint, which sees a slug match and issues a publish credential.
  4. The attacker pushes a malicious version under the real package name.

There is a real limit on the blast radius. The victim's trusted publisher must point at a slug an attacker can claim, and the repository must never have published a version of the package. A package with a validated binding was not exposed by this path.

How Do You Audit Your npm Trusted Publisher Bindings?

Open each package on npmjs.com, go to Settings, then Trusted publishing, and read every connection. For each one, confirm that the owner and repository resolve to a repo your team controls today. Delete anything that does not, then recreate the binding against the current slug.

Colorful code on a laptop screen while a developer reviews package settings

The npm trusted publishing documentation says a package can hold up to 10 connections, and an existing connection cannot be edited. To change one, you delete it and create a new one. That is slower than an edit, but it forces a fresh look at what you are trusting.

To check a repository's identity quickly, ask GitHub for its permanent ID and owner. A binding that names an owner you no longer recognize is your answer.

text
gh api repos/OWNER/REPO --jq '.id, .owner.login'

Work through the audit in this order:

  1. Export a list of every package your organization publishes, including old ones nobody touches.
  2. Record the owner, repository, workflow filename, and environment name for each binding.
  3. Check that each repository still exists at that exact path and that your team owns it.
  4. Delete the binding for any repository that was renamed, transferred, or deleted.
  5. Recreate the binding and publish once to validate it.
  6. Review recent publish events for versions nobody on your team released.

That last step catches what the earlier steps miss. Publish history is the only record that tells you whether a binding was already used against you.

Which Packages Are Most at Risk From a Reclaimed Slug?

The riskiest packages share a history. Their repository was renamed, moved to a new organization, or deleted, and the trusted publisher binding was never updated. Packages that were bound but never published from CI are the worst case, because they were never validated.

Abandoned side projects deserve a second look. A company rebrand often renames repositories in bulk, and each rename frees an old slug. Those old slugs are exactly what an attacker wants to claim.

Scale makes this worse. Bloom Security counted more than 1,500 vulnerable packages with over 10 million downloads between them. One hijacked package can spread through its dependents, which is why researchers likened the risk to a Shai-Hulud-style cascading supply chain attack.

AI coding tools raise the stakes. Bloom Security warned that agents resolve dependencies on their own, tend to take the latest version, and rarely check where a package came from. Backtrace's explainer on how GitSpawn runs code through AI coding agents shows how little friction sits between an agent and untrusted input.

What Changed at GitHub and npm After the Report?

GitHub now expires an unvalidated trusted publishing configuration 48 hours after creation. Validation happens on the first successful publish, which binds the configuration to the repository's immutable identity. Changing the repository or project identity starts a new trust relationship with a fresh 48-hour window.

Smartphone showing a stopwatch, standing in for the 48-hour validation window

The same update stops npm from accepting trusted publishing tokens minted by GitHub Actions issue_comment events. It sits beside an existing restriction on pull_request_target. Both events can run in response to input from people outside your team.

What Changed at GitHub and npm After the Report?
ChangeWhat it doesWhat you should do
48-hour expiryUnvalidated bindings stop working after two daysPublish once right after creating a binding
Immutable identityFirst publish ties trust to the permanent repository IDRecreate old bindings so they validate
issue_comment blockRejects tokens from comment-triggered workflowsRemove comment triggers from publish jobs
pull_request_target blockExisting rule against tokens from that eventKeep publish jobs on tags or releases

Do not read the expiry as a cure. It protects new bindings, and it does nothing for an old binding that was never validated and still points at a loose slug. The audit above is still your job.

How Do You Lock Down the Publish Workflow Itself?

Keep the publish job small and trigger it only from tags or releases. Grant the id-token write permission to that job and nothing else beyond read access to contents. The npm documentation's own example publishes on pushed version tags, which is a sound default.

Source code for a web project on screen, representing a publish workflow file

Then close the other doors. Set the package's publishing access to require two-factor authentication and disallow tokens, so a leaked token cannot bypass the trusted path. For sensitive packages, configure stage-only permissions, which allow npm stage publish but not a direct publish and send every automated release through maintainer review.

Consider adding an environment name to the binding as well. The npm documentation lists it as an optional field for teams that use GitHub environments for deployment protection. A protected environment can add a human approval before a release goes out.

Check your toolchain as well. Trusted publishing needs npm CLI 11.5.1 or later and Node 22.14.0 or higher. If your release runner is behind, start with Backtrace's checklist for upgrading to Node.js 26 LTS before you touch the workflow.

Finally, treat the workflow file as part of your attack surface. Backtrace's guide to checking repos for the GhostAction workflow covers the Actions hardening that protects a publish job from a poisoned neighbor.

What Should You Monitor After the Audit?

Watch publish activity as closely as you watch your own releases. Every legitimate version should match a tag or release your team created. A version that appears without one deserves an immediate look, because that is what a hijack looks like from the outside.

Provenance helps here. Packages published through trusted publishing from GitHub Actions get provenance attestations automatically, so consumers can see where a package was built. Provenance generation is not currently supported for CircleCI, so those packages carry no attestations.

Set a simple alert on your package feed. Flag any new version published outside your normal release window or from a workflow you do not recognize. It costs little, and it turns a silent compromise into a page.

Conclusion

SlugFest was a trust problem, not a credential problem. Audit every npm trusted publisher binding, delete the stale ones, recreate them against the current repository, and publish once to validate each. Then lock down the workflow and the package settings around it.

Your next step is to pick your three most downloaded packages and audit them today. At Backtrace, we treat any trust anchored to a name as a bug waiting for a rename, and a rename is the one event that happens to every repository eventually.

Was my npm package affected by SlugFest?
Possibly. Your package was exposed if its trusted publisher pointed at a GitHub slug an attacker could claim, and the repository had never published a version of it. Check your bindings, confirm each repository path still belongs to you, and review your publish history for unexpected versions.
Do I need to delete my trusted publisher configuration?
Only if it is stale. If the repository was renamed, transferred, or deleted, delete the binding and recreate it against the current repository. Existing connections cannot be edited, so a delete and recreate is the only way to change one. Healthy, validated bindings can stay.
What does the 48-hour trusted publisher expiry mean?
A newly created trusted publisher configuration must complete a successful publish within two days. That first publish validates it and binds it to the repository's permanent identity. If you miss the window, the configuration expires and you must delete it, create a new one, and try again.
Should I still use npm tokens if I have trusted publishing?
Not if you can avoid it. Once trusted publishing works, set the package's publishing access to require two-factor authentication and disallow tokens. That removes a long-lived credential that could bypass the trusted path. Keep a documented recovery plan for the case where your CI provider is unavailable.

Written by

Marcus Oyelaran

Security & DevOps Specialist

11+ years experience

Marcus Oyelaran spent eleven years moving between platform and security teams, including four years as a security engineer embedded inside a DevOps org at a healthcare SaaS company handling PHI at scale. He's run more incident postmortems than he can count, and most of what he writes for Backtrace comes directly out of those postmortems: the secret that leaked through a build log, the IAM policy that was too permissive by one wildcard, the deploy that skipped a gate because someone was in a hurry. He holds an OSCP and spends an unreasonable amount of time arguing about supply chain security on internal Slack channels.

Credentials

  • OSCP (Offensive Security Certified Professional)
  • 11 years in DevOps and security engineering
  • Former security engineer, healthcare SaaS platform (HIPAA-regulated infrastructure)