NPM Trusted Publishing is a way to publish packages to the npm registry without storing a long-lived npm password or token in a developer account. It uses short-lived federation from a trusted identity provider, usually through OpenID Connect, so the publish action is tied to a verified build or release workflow.
What Trusted Publishing Changes for npm Package Releases
NPM Trusted Publishing shifts release trust away from a stored long-lived npm token and toward a short-lived federated assertion from a trusted identity provider. The practical effect is that the publish event is tied to the build or release workflow itself, which reduces the value of static publishing secrets and makes provenance easier to reason about.
This matters because package publishing is not just a delivery step, it is a trust boundary. When a registry accepts a release based on a workflow-backed identity assertion, the security model depends more on the integrity of the CI or release path than on a developer remembering to protect a reusable token.
Why It Matters for Supply Chain Integrity
Trusted publishing is best understood as a supply chain control, not merely a convenience feature. It helps narrow the gap between code creation, build execution and registry publication, so that consumers can place more weight on how the artifact was produced.
npm Trusted Publishing and Provenance Guide explains how OIDC trust policies, stage-only releases and workflow hardening fit together, while Node.js Security Guide places trusted publishing in the broader context of npm security and install-time risk.
The security value is strongest when the release workflow is tightly controlled and the organization can verify which identity, repository and build context are allowed to publish. Without that discipline, the trust shift from token custody to workflow integrity can be weakened by misconfigured automation or overbroad federation rules.
How Federation and OIDC Change the Publishing Model
Under trusted publishing, npm does not need a long-lived shared secret sitting in a developer account or CI secret store for every release. Instead, a trusted identity provider issues a short-lived assertion, usually through OpenID Connect, and npm uses that assertion to authorize the publish action.
This changes the attack surface in an important way: the main question becomes whether the workflow is genuinely the one that should publish, not whether an attacker can steal and reuse a durable npm token. The model also helps reduce token sprawl across laptops, automation systems and secret managers.
npm Tokens Security Guide covers the transition away from classic and long-lived publishing tokens, and npm Token Changes and Trusted Publishing focuses on the operational move from token-based publishing to OIDC-backed release flows.
What Consumers and Maintainers Should Look For
For maintainers, the important operational signal is whether a package is being published through a controlled workflow with provenance, rather than through ad hoc manual publishing. For consumers, the useful question is whether the package ecosystem provides enough release evidence to distinguish a normal build from a potentially hijacked publication path.
That is why trusted publishing is often discussed alongside provenance, signing and repository policy. A good release posture does not rely on a single safeguard, it combines workflow identity, release governance and consumer verification.
Package Registry Security Comparison Guide is useful when comparing npm with other ecosystems, while OWASP Top 10 A03 Guide explains why build and publish integrity are central to software supply chain risk.
What Trusted Publishing Does Not Solve By Itself
Trusted publishing reduces one major class of secret exposure, but it does not automatically stop malicious code in a build, compromised source control, or abuse of the workflow that issues the OIDC assertion. If the release pipeline itself is hijacked, the registry can still receive a trusted but malicious artifact.
It also does not remove the need for review of release permissions, repository protections, runner hygiene and consumer-side due diligence. The control is strongest when treated as part of a broader release integrity program, not as a stand-alone fix for package compromise.
Risk and Threat Considerations
The main risk is that organisations may believe trusted publishing removes supply chain exposure when it actually shifts where the exposure lives. Attackers often prefer the release path because compromise of the publishing workflow can yield a signed or trusted package that downstream users will accept.
Failure mechanism: A malicious actor compromises source control, CI, or release automation, then abuses the workflow trust relationship to publish a tainted package without needing a reusable npm token.
Impact: The result can be package compromise, downstream dependency contamination, rapid propagation through automated updates, and longer detection time because the publish path looks legitimate.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP ASVS, SLSA, CIS Controls v8 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP ASVS | V10 — OAuth and OIDC | NPM trusted publishing uses OIDC federation to authorize releases. |
| Recommendation — Use OIDC-based release authentication for publishing workflows. | ||
| SLSA | Supply-chain integrity | Trusted publishing strengthens artifact provenance and release-chain trust. |
| Recommendation — Require provenance evidence for published packages and release artifacts. | ||
| CIS Controls v8 | CIS-16 — Application Software Security | Secure publishing workflows are part of protecting software release paths. |
| Recommendation — Harden software release pipelines and restrict who can publish releases. | ||
| NIST SP 800-53 Rev 5 | IA-5 — Authenticator Management | Trusted publishing replaces durable publishing secrets with short-lived authentication material. |
| IA-9 — Service Authentication | Workflow-based federation authenticates an automated publishing service to npm. | |
| Recommendation — Rotate, bound and minimize secrets used in release authentication. Authenticate CI and release services with federated, short-lived credentials. | ||
Practitioner Guidance
Governance implication: Treat trusted publishing as a release-policy decision, not just an authentication setting. The allowed issuer, repository, branch and workflow context should be tightly scoped so that only the intended release path can mint publish authority.
What to watch for: Review whether your publishing process still depends on fallback tokens, manual overrides or loosely controlled workflow changes. Those are the places where the security benefit of federation is most often lost.
Practitioner takeaway: The control is strongest when you remove durable secrets, harden the release workflow and verify that consumers can see clear provenance evidence.
Related resources from NHI Mgmt Group
- How should security teams implement Trusted Publishing for npm packages in CI pipelines?
- Why do trusted publishing and provenance not fully protect npm packages from supply chain compromise?
- Should teams prioritize OIDC trusted publishing over token rotation for npm releases?
- How should security teams protect npm and package publishing workflows from identity compromise?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org