Pair Staging With Trusted Publishing
The strongest pattern is staged publishing plus trusted publishing. Trusted publishing uses OIDC so CI can publish without long-lived npm tokens sitting in workflow secrets. Staged publishing then prevents that trusted workflow from being the final word on release availability. GitHub's recommended setup allows a trusted publishing configuration to be limited to stage-only behavior, so the workflow can upload to the stage queue but cannot directly publish the final package.
For maintainers, this makes the release pipeline less dependent on a single secret and less vulnerable to a single workflow compromise. For consuming organizations, it gives a more credible story about how upstream packages are released: short-lived workflow identity, provenance where available, and human approval before distribution.
The tradeoff is operational. Maintainers need npm CLI 11.15.0 or newer, CI workflows need to use `npm stage publish`, and release owners need a habit for approving staged artifacts from trusted devices. That is work, but it is smaller than rebuilding trust after a poisoned package lands in customer build systems.
Install-Time Controls Close a Different Door
The same GitHub update added install-source flags for npm that complement the existing Git-source control. Teams can now choose stricter behavior for installs from local files, remote tarball URLs, local directories, and Git sources. That matters because malicious dependency paths do not always arrive as ordinary registry packages. They can hide in a package manifest, a lockfile change, or a build job that fetches code from a place the reviewer did not expect.
For CI, the defensive move is to make unusual dependency sources explicit. If a production build should only install registry packages, configure CI to reject remote URL, local file, local directory, and Git dependency sources unless a specific workflow requires them. When a repository genuinely needs one of those sources, isolate it and document why. The value is not that flags solve dependency risk. The value is that they turn surprise dependency sources into policy violations instead of silent behavior.
What Security Teams Should Ask Maintainers
Security teams do not need to own every package release, but they should ask better questions of the packages and internal libraries that matter most. Which packages can publish directly from CI? Which still use long-lived npm tokens? Which require 2FA at the final release step? Which build jobs allow remote tarball or Git dependency installs? Which maintainers can approve a staged release, and from what devices?
Those questions map directly to incident containment. If a maintainer account or workflow is compromised, staged publishing may keep a malicious package from becoming installable. If a lockfile is poisoned, install-source restrictions may stop the build. If a token is gone because trusted publishing replaced it, there is less reusable credential material for the attacker to steal.
The right framing is modest but useful: npm's new controls add reviewable friction where package compromise has been too fast and too quiet. Roll them out first on packages with broad downstream reach, internal libraries that enter production images, and developer tooling that runs with access to secrets. That is where one bad publish can become many credential thefts.