How to Validate npm Trusted Publishing Before the 48-Hour Expiry
GitHub now expires unvalidated npm trusted publishing configurations after two days. Here is how to validate yours and audit the old ones.
On this page 7 sections
npm trusted publishing configurations now expire 48 hours after you create them, unless a first successful publish validates them. To keep releasing without tokens, publish once from the configured repository inside that window. Validation binds the configuration to the repository's permanent ID instead of its name, which closes the SlugFest takeover path.
This guide is for maintainers who publish packages to the npm registry from GitHub Actions. It covers what changed, how to validate a new configuration, how to audit the ones you already have, and which settings to tighten next. Backtrace covers developer security from the pipeline side, so the focus here is on workflow settings you can change today.
The change landed on October 2, 2026, after researchers showed that a trusted publishing binding could be hijacked without stealing a single credential. Most teams adopted trusted publishing to get rid of long-lived tokens. That goal still stands, but the setup now has a deadline attached.
What Is npm Trusted Publishing and How Did SlugFest Break It?
npm trusted publishing lets a CI provider such as GitHub Actions publish a package using a short-lived OpenID Connect (OIDC) token instead of a stored secret. SlugFest abused the fact that npm matched a repository by its owner/name slug until the first publish, so an attacker who reclaimed a freed slug could mint valid credentials.
GitHub made trusted publishing available in July 2025 as a credential-free way to publish. The Hacker News reported that Bloom Security found more than 1,500 vulnerable packages with over 10 million combined downloads, and that the flaw was reported to GitHub on June 6, 2026.
The attack needed no stolen password. An attacker waited for a maintainer to rename, transfer, or delete a repository, then created a new repository at the freed owner/name path. GitHub gave that repository a fresh numeric ID, but npm ignored the ID until the first publish. The attacker's OIDC token carried the right slug, so npm issued a publish credential.
Packages whose trusted publisher had never published a version were exposed. That is the gap the 48-hour window closes. Backtrace's editors read the episode as a reminder that a human-readable name is a weak anchor for trust. Any binding that can silently change hands deserves an expiry date.
Going back to tokens is not the fix. A long-lived automation token can leak through a build log, a compromised dependency, or a laptop backup. Trusted publishing removes that class of leak, so the expiry rule narrows the new risk instead of abandoning the model.
How Does the 48-Hour Expiry Work?
An unvalidated trusted publishing configuration stops authorizing publishes 48 hours after you create it. The first successful publish from the configured repository validates it and exempts it from expiry. Changing the repository or project identity later starts a fresh 48-hour validation window, while ordinary edits do not restart the clock.
GitHub's changelog entry adds that expired configurations stay visible in the trusted publisher settings but no longer count toward per-package limits. Other valid configurations on the same package are unaffected.
Two practical problems follow. A configuration created on a Friday afternoon can lapse before Monday's release. A package that has not shipped in months can also carry a binding that nobody ever validated. Teams on a slow release train should create the configuration and run the first publish on the same day.
Which Teams Are Most Likely to Hit the Expiry?
Monorepos, on-demand libraries, and anything on a quarterly release cadence are the likeliest to trip the window. A monorepo that publishes a dozen packages needs a trusted publisher for each one, and every configuration has its own 48-hour clock. Create them in one sitting and publish all of them in the same release run.
Teams that gate releases behind a change-approval board have a different problem. If approval takes three days, the configuration expires while the release waits. Create the configuration after approval, not before.
Maintainers who inherit a package should treat every existing binding as unverified until they have read it line by line. The owner field may name an account that no longer exists. A package handed over in a team reshuffle may still list the previous owner's personal repository. Check the settings page for each package instead of assuming the last maintainer cleaned up.
How to Validate npm Trusted Publishing Before the Window Closes
Follow these steps in order so the first publish lands well inside the 48 hours.
- Create the trusted publisher on the package's npm settings page. Enter the exact GitHub owner, repository, and workflow filename.
- Add
id-token: writeandcontents: readunderpermissionsin the publishing workflow. - Trigger the workflow from a permitted event such as
push,release, orworkflow_dispatch. - Confirm the publish succeeded and that the new version carries a provenance attestation.
- Write the creation date and the configuration details into your release runbook.
The npm documentation on trusted publishers includes a complete workflow example. It sets the OIDC permission, uses actions/setup-node with the registry URL, and ends with npm publish. Copy that shape instead of inventing your own, and note that the example turns off dependency caching for release builds.
If you only publish from tagged releases, push a patch tag right after you save the configuration. A pre-release such as 1.4.1-rc.0 also validates the binding. It does create a permanent version on the registry, so pick a version number you are happy to keep.
If the first publish fails, read the workflow log before you retry. Check that the job has id-token: write, that the workflow filename matches the configuration exactly, and that the run came from a permitted event. Fix the cause, then rerun inside the window.
How Do You Audit Existing Trusted Publisher Bindings?
List every package you maintain, open its trusted publisher settings, and compare the listed owner and repository against the repositories you control today. Any binding pointing at a renamed, transferred, or deleted repository should be deleted and re-created against the current slug, followed by a first publish to validate it.
To check a binding by hand, compare three values: the owner, the repository name, and the workflow filename. A mismatch in any of them makes the publish fail with an authorization error, which burns part of your 48 hours. It is worth reading all three aloud against the repository's current settings.
The table below maps the common situations to the action that fits each one.
| Situation | Risk | Action |
|---|---|---|
| Repository renamed, binding never used to publish | Old slug can be reclaimed | Delete the binding, re-create it, publish once |
| Repository transferred to another organization | Binding still names the old owner | Re-create under the new owner, publish once |
| Repository deleted | Slug is free for anyone to claim | Delete the binding the same day |
| Validated binding, repository unchanged | Low | Keep it and recheck after any rename |
The same research advises watching for unexpected publish events and deleting trust bindings whenever a repository is deleted, transferred, or renamed. Make that a line item in your repository offboarding checklist, next to archiving the repo and removing deploy keys.
Audits stick when they are routine. Backtrace's walkthrough of the GitLab CVE-2026-110264 upgrade shows how to turn a one-off patch into a repeatable checklist, and the same habit works for registry settings.
Which Other Settings Should You Lock Down Next?
Validation fixes one hole. While you are in the settings page, tighten the following items.
- Restrict token publishing. After trusted publishing works, open Publishing access and select the option that requires two-factor authentication and disallows tokens.
- Move off
issue_commenttriggers. npm now rejects trusted publishing tokens from those events, in addition topull_request_target. - Pin action and Node versions in the release workflow, and keep caches out of release builds.
- Alert on any publish event you did not start yourself.
Treat the workflow file itself as a protected asset. Require review from a code owner on any change under .github/workflows, because anyone who can edit the publishing workflow can publish. Branch protection on the release branch or tag pattern keeps a stray push from triggering a release you did not plan.
Alerting is easier when your logs are structured and searchable. Backtrace's guide to structured logging in production covers the fields worth capturing. The Node version your release job pins matters too, so keep an eye on the Node.js release schedule change when you plan upgrades.
Bloom Security also warned that AI agents resolving dependencies on developer machines tend to grab the latest version and rarely check where a package came from. Until agents verify provenance themselves, a quick human review of new versions on critical dependencies is cheap insurance.
What to Do This Week
Open your npm packages and find any trusted publisher that has never published. Push a release through it today. Then audit repositories that were renamed or transferred, disallow tokens, and move publishing off issue_comment triggers.
At Backtrace, we would rather see a boring release job that fails loudly than a clever one that trusts a name. The 48-hour window is a mild annoyance for two days. After that, it is just one more fact about how your package is published.