How to Audit npm Trusted Publishing After the SlugFest Flaw (2026)
A rename can hand your npm publish rights to a stranger. Here is the audit, the repair and the workflow settings that keep it fixed.
On this page 6 sections
To audit npm trusted publishing, list every trusted publisher binding on your packages. Confirm each owner/repository slug still points to a repository you control. Delete bindings for renamed, transferred or deleted repositories, recreate them with the current slug, and finish a first publish within 48 hours so the binding locks to the repository's permanent ID.
Backtrace tests developer tools against real codebases, and this one sits squarely in that remit. In October 2026, GitHub changed how npm trusted publishing works after researchers showed that a repository rename could hand your publish rights to a stranger. This guide is for maintainers and platform engineers who ship npm packages from GitHub Actions. It walks through the flaw, the audit, the repair, and the workflow settings that keep the fix in place.
You do not need to be a security specialist. You need access to your package settings on npmjs.com and to the repositories that publish them.
What Did the SlugFest Flaw in npm Trusted Publishing Exploit?
SlugFest exploited the fact that npm stored a trusted repository's name, such as owner/repository, instead of the permanent ID GitHub assigns it. Until the first successful publish, npm checked only the name. Anyone who reclaimed a freed name could mint a valid publish token.
Trusted publishing arrived in July 2025 as a way to publish without long-lived secrets. Your CI provider issues a short-lived OpenID Connect (OIDC) token for one workflow run, and the npm registry checks it against a configuration you approved in advance. It also produces provenance attestations, which show where a package was built.
The weak point was identity. As The Hacker News reported, researchers at Bloom Security found over 1,500 vulnerable packages with more than 10 million combined downloads. They reported the issue to GitHub on June 6, 2026.
The attack needed no stolen credentials. An attacker creates a repository at the freed owner/repository path, which gives GitHub a fresh numeric repository ID. A workflow in that repository mints an OIDC token that carries the old name. npm sees a name match and issues a publish credential. The attacker then pushes a malicious version under the legitimate package name, with its download counts and dependents intact.
Repository names are reusable, while numeric repository IDs are not. GitHub's OIDC tokens already carried the numeric ID, but npm ignored it until a first publish succeeded. Binding to the ID earlier is the heart of the fix.
The one precondition matters for your audit. The binding must never have been used for a successful publish. Packages that publish through a binding regularly were not exposed in the same way, but a binding you created and never used was.
How Do You Audit npm Trusted Publisher Bindings?
Open each package's settings on npmjs.com, go to Trusted publishing, and read every listed connection. For each one, check that the owner and repository still resolve to a repository your team owns today. Note whether the binding has ever completed a publish. Delete anything you cannot explain.
The npm trusted publishers documentation says each package can hold up to 10 trusted publisher connections at once. That limit is generous, which means old entries can pile up unnoticed. In our experience, the bindings that go stale are the ones nobody remembers creating.
Work through this sequence for every package you maintain:
- List the packages your organization publishes, including internal and archived ones.
- Open each package's Trusted publishing settings and record every connection.
- Visit the listed repository path and confirm your organization still owns it.
- Check the repository's history for renames, transfers or deletions.
- Check whether each binding has completed at least one publish.
- Delete every binding that fails any of those checks.
The table below shows how to triage what you find.
| What you find | Risk | Action |
|---|---|---|
| Slug resolves to your repo, binding has published | Low | Keep it |
| Slug resolves to your repo, binding never published | Medium | Run a release to validate it |
| Repo was renamed or transferred | High | Delete and recreate with the new slug |
| Repo was deleted | High | Delete the binding now |
| Slug resolves to a repo you do not own | Critical | Delete it and review recent publish events |
Include packages owned by the personal accounts of former teammates, since those bindings are the easiest to forget.
Treat the critical row as an incident. Check the package's version history for releases nobody on your team shipped.
Rebuild Trusted Publishing After a Rename or Transfer
GitHub's fix is a clock. Under the October 2 GitHub changelog entry, an unvalidated configuration expires 48 hours after creation and can no longer authorize publishing. A configuration becomes validated after its first successful publish.
That changes how you plan a rebuild. Do not create a binding on Friday afternoon and leave the release for next week. Create it when you are ready to publish, and ship a release right away.
Plan the first release as a real one. If it fails, the window keeps running, so fix the workflow quickly or recreate the binding.
Existing connections cannot be edited. The npm documentation notes that the provider and required fields are fixed once a connection exists. To change one, you delete it and add a new one. Changing the repository or project identity also starts a fresh 48-hour window, while ordinary edits do not restart the deadline.
A safe rebuild follows this order:
- Add the new binding with the current owner and repository name.
- Confirm the publish workflow file name matches the one you entered.
- Trigger a patch release from a permitted event.
- Confirm the release shows provenance on the package page.
- Delete the old binding.
If a configuration expires before you publish, the changelog says to recreate it. Expired entries stay visible in settings but do not count toward the per-package limit.
Backtrace's editors suggest one more habit. Put "delete the trusted publisher binding" on the checklist for every repository rename, transfer or deletion. The flaw lived in that gap between a routine repository change and a registry setting nobody touched.
Which GitHub Actions Settings Keep Publishing Safe?
Publish from push, release or workflow_dispatch events only, and keep those triggers narrow. npm now rejects trusted publishing tokens from issue_comment events, on top of the earlier pull_request_target restriction. Both events let outside contributors trigger workflows, so neither should be near a publish step.
Start by reading your publish workflow. If it triggers on a comment or on a pull request from a fork, move the publish job to a tag or release trigger. Keep the job in its own workflow with minimal permissions, and grant the id-token write permission only to that job.
Next, close the old door. The npm documentation recommends that once trusted publishers work, you open the package's Publishing access settings and choose the option that requires two-factor authentication and disallows tokens. A leaked token then stops being a way to publish. The same discipline applies to routine runtime updates, as in our walkthrough on patching Node.js after the November 2026 security release.
One new option deserves a deliberate decision. A September 30 GitHub changelog entry describes an opt-in Allow npm dist-tag permission. It lets a trusted publishing configuration promote a version to latest or move next and beta pointers using short-lived credentials. It defaults to off for new and existing configurations.
Turning it on lets you drop the long-lived token you kept only for tag management. Turn it on only for the configuration that actually handles releases, because the permission is independent of direct publishing.
How Do You Watch for Bad Publishes Afterward?
Watch for npm publish events your team did not trigger, and compare each new version against a release you remember shipping. Check each package's version history on a schedule. Review the version history after any repository rename, transfer or deletion, since that is when this attack opens up.
Consumers need the same suspicion. AI agents resolve dependencies on their own and tend to take the newest version, which the researchers flagged as a way to speed a bad release along. Our review of autonomous coding agents covers where those tools hold up and where a human check still matters.
A pinned lockfile and a short delay before adopting brand-new versions give you time to notice trouble. If something looks wrong in a repository, our guide to checking your repos for the setup.js agent malware shows what a compromised install leaves behind.
The researchers' advice boils down to four habits: audit your bindings, recreate them after a rename, monitor publish events, and delete a binding whenever its repository is deleted, transferred or renamed.
Provenance helps here as well. A package that suddenly lacks provenance after months of having it is worth a second look, because it may have been published by a path you did not configure.
Conclusion
The SlugFest flaw was not a break in cryptography. It was a name standing in for an identity, and it stayed exploitable for as long as a binding went unused. GitHub's 48-hour expiry closes much of that gap, but it cannot clean up the stale bindings already sitting in your settings.
Spend an hour this week on the audit. Delete what you cannot explain, validate what you keep with a real release, and move publishing onto safe events. Then add the binding cleanup to your repository rename checklist so the problem does not return.