Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › CI/CD

What npm Trusted Publishing Is and How OIDC-Based Publishing Works

By Freedom251 Team · · 9 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Yes—you can publish an npm package from supported CI/CD systems without storing a long-lived npm write token. npm trusted publishing links a package to a specific workflow through OpenID Connect (OIDC). When that workflow runs, the CI provider issues a short-lived, signed identity token; the npm CLI exchanges it for temporary publish authorization.

This removes a persistent write credential from your CI secrets, but it does not authenticate every npm command, make a compromised workflow harmless, or guarantee that published code is safe. You still have to configure the exact workflow identity, protect release triggers, and use a separate read credential when the build installs private dependencies.

As an Amazon Associate I earn from qualifying purchases.

What npm trusted publishing changes

Traditional automated publishing usually stores an npm access token in a CI secret. That token may remain valid until someone rotates or revokes it, so a leaked secret can be reused outside the intended workflow. Trusted publishing replaces that persistent credential with an OIDC exchange tied to a configured CI identity.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You first register a trust relationship for the package. The relationship identifies the provider and the workflow, project, repository, or environment that is allowed to publish. At release time, the provider signs an OIDC identity token for that run. A recent npm CLI detects the supported OIDC environment and presents the token to npm, which returns short-lived publishing authorization for the permitted operation.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

The authorization is deliberately narrow. A configuration can allow direct npm publish, staged publishing, and, if separately enabled, distribution-tag changes. It is not a general replacement for npm login credentials.

How the OIDC publishing flow works

  1. Trust is configured on the package. A maintainer adds the CI provider and the exact identity fields in the package’s Trusted Publisher settings, or manages the relationship with the npm trust command.
  2. The workflow requests an OIDC token. The CI job must have permission to request an identity token. The token describes the provider, repository or project, workflow, and other claims used for validation.
  3. The npm CLI exchanges the token. npm validates that the claims match the package’s trusted-publisher entry and issues temporary publish authorization.
  4. The requested operation runs. The job can publish directly, submit a staged release for review, or perform an explicitly enabled dist-tag operation.
  5. The credential expires. The workflow does not retain a reusable npm write token after the run.

Authentication, authorization, and provenance are separate concepts. OIDC answers “which configured workflow is asking to publish?” A provenance attestation records claims about the source repository and build. Neither one proves that the package’s source is benign.

Supported CI providers and requirements

npm’s current trusted-publishing guide lists these hosted environments:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Provider Runner model listed by npm Identity fields to register OIDC configuration detail Automatic provenance
GitHub Actions GitHub-hosted runners Organization or user, repository, workflow filename, and optionally an environment The job needs id-token: write Yes, when the package is public and the repository is public
GitLab CI/CD GitLab.com shared runners Namespace, project, top-level CI file path, and optionally an environment Configure an ID token with audience npm:registry.npmjs.org Yes, when the package is public and the repository is public
CircleCI CircleCI cloud Organization, project, pipeline definition IDs, VCS origin, and optionally context IDs Obtain the OIDC token and export it as NPM_ID_TOKEN Not currently generated automatically

Self-hosted runners are not currently supported in npm’s guide. Provider support and field requirements are volatile, so check npm’s live trusted-publishing documentation before changing a release pipeline.

Version prerequisites

The overview requirements are distinct from the requirement for the trust-management command:

  • Use npm CLI 11.5.1 or later and Node.js 22.14.0 or later for the current trusted-publishing workflow.
  • The npm trust configuration command requires npm 11.15.0 or later.
  • OIDC-based dist-tag operations have a newer CLI minimum in npm’s documentation: 11.21.0 or 12.2.0, depending on the npm major version. Verify the exact requirement in the current guide before enabling that operation.

Do not infer that installing one version number satisfies every task. A team can have a CLI new enough to publish while still being too old to manage trust entries or perform OIDC dist-tag changes.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Configure a trusted publisher

1. Register the exact workflow identity

Open the npm package’s Trusted Publisher settings and add the provider. Enter every required field exactly as the provider reports it. npm treats these values as case-sensitive. For GitHub, that means the organization or user, repository, workflow filename, and any selected environment. For GitLab, enter the namespace, project, top-level CI configuration path, and optional environment. For CircleCI, enter the organization, project, pipeline definition IDs, VCS origin, and optional context IDs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A package can have up to 10 trusted-publisher configurations. Existing entries cannot be edited in place; delete the old entry and create a new one if a provider, repository, workflow file, or required field changes.

2. Choose the allowed operations

Grant only what the release process needs. Direct publish lets the workflow make a release immediately. Stage-only access lets CI submit a package for a maintainer’s interactive approval before it becomes public. Dist-tag management is a separate capability and should be enabled only when the workflow must move tags such as a release channel.

3. Give the job permission to request OIDC

For GitHub Actions, add the token permission at the workflow or job level:

permissions:
  contents: read
  id-token: write

The release job should then use a supported Node.js and npm version and run the normal publish command:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
npm ci
npm publish

The important detail is not a special long-lived secret; it is that the job can request an OIDC token and that the npm CLI is new enough to use it.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord | 6.35mm Jack, Durable Design, Stage and Home Studio Use, Low Noise Shielded Electric Cord for Bass, Keyboard, Amp, Mixer
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

GitLab requires an ID-token declaration whose audience is exactly npm:registry.npmjs.org. CircleCI’s configuration obtains an OIDC token and makes it available as NPM_ID_TOKEN. Follow each provider’s current syntax because YAML keys and token plumbing are provider-specific.

4. Complete the first validation publish

After creating a publisher entry, complete its first successful publish within two days. npm says an unused new entry expires after that window. If it expires, delete it and create the configuration again before rerunning the release.

5. Verify the real operation

Test with the intended publish or staged-publish workflow in a controlled release. npm whoami is not a valid test of trusted-publisher permissions; it does not exercise the OIDC authorization path used by publishing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Provider-specific setup checks

GitHub Actions

  • The registered workflow filename must match the file that performs the release.
  • The package’s repository.url must point to the same GitHub repository registered in npm.
  • The job or workflow must include id-token: write.
  • If a reusable or child workflow is called by another workflow, npm notes that validation may use the calling workflow name. Check both names and set the required permissions on the parent and child workflows.
  • Use deployment environments for approval gates and tag protection to control who can create release tags.

GitLab CI/CD

  • Confirm that the namespace, project, and top-level CI file path match the trusted-publisher entry, including capitalization.
  • Set the ID-token audience to exactly npm:registry.npmjs.org.
  • Use GitLab.com shared runners; self-hosted runners are not listed as supported.

CircleCI

  • Match the organization, project, pipeline definition IDs, VCS origin, and any context IDs exactly.
  • Obtain the provider token and export it as NPM_ID_TOKEN for the npm CLI.
  • Do not expect an automatic npm provenance attestation from a CircleCI trusted publish at this time.

Do you still need an npm token in CI?

For the supported publish operation, no long-lived npm write token is required. The workflow obtains temporary authorization through OIDC instead.

You may still need a credential for other jobs. In particular, a build that installs private npm dependencies needs read access. npm recommends using a separate read-only granular token for that installation rather than treating the publishing trust relationship as general registry authentication.

Commands such as private-package installation or access-management operations should therefore be designed independently from the publish step. Keep a read credential scoped to the smallest package set and environment that needs it, and do not give that credential publish rights.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Provenance: what it proves and when it appears

Qualifying trusted publishes from GitHub Actions and GitLab CI/CD automatically generate npm provenance attestations when the package is public and the source repository is public. A private repository is not eligible even if it publishes a public package. CircleCI trusted publishing does not currently generate automatic provenance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Consumers can use provenance to inspect the claimed connection between a package, its source repository, and the build instructions that produced it. Treat that record as evidence to evaluate, not as a security verdict: a documented build can still compile vulnerable or malicious source, and provenance does not replace code review, dependency review, or runtime controls.

Security decisions and hardening

Limit the trust relationship

Use the narrowest repository, workflow, environment, and operation fields available. A release workflow should not be able to publish merely because it runs somewhere in the same organization. Review changes to workflow files and release triggers as carefully as application code.

Separate build submission from release approval

Stage-only publishing is useful when CI should assemble and submit a package but a human must approve the final release. This creates a deliberate checkpoint without putting a permanent write token in the build environment.

Protect release triggers

For GitHub, npm recommends deployment environments for approvals and tag protection for release-tag creation. Apply equivalent controls in other providers: restrict who can start production releases, require review for workflow changes, and prevent untrusted pull-request code from reaching a publish job.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Retire older credentials

After the OIDC path succeeds, review traditional npm automation tokens. Revoke unused publish tokens, restrict any remaining token to the minimum scope, and use npm’s two-factor-authentication settings where they fit your release process. OIDC reduces the persistence of the publishing credential; it does not remove the need to secure accounts, repositories, and CI permissions.

Troubleshooting failed trusted publishes

“The publisher does not match”

Compare every registered field with the actual run: provider, organization or namespace, repository or project, workflow or CI file path, environment, and (for CircleCI) pipeline and VCS identifiers. Check capitalization. If the configuration itself must change, delete it and recreate it because npm does not provide in-place editing.

GitHub reports an identity or permission error

Verify the workflow filename, the package’s repository.url, and id-token: write. For reusable workflows, inspect both the calling and called workflow names and permissions.

GitLab rejects the token

Check that the ID-token audience is exactly npm:registry.npmjs.org and that the namespace, project, and top-level CI file path match the npm entry.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The configuration suddenly stopped working

Check the npm and Node versions first. Then verify that the entry was used for its first successful publish within the two-day validation period. An expired entry must be deleted and recreated.

The team expects npm whoami to pass

That command does not validate trusted-publisher permissions. Run the actual intended publish or staged-publish operation in a controlled package and inspect the resulting release.

A private dependency install fails

OIDC publishing is not a private-package read credential. Add a separate read-only granular token for the installation step and keep it out of the publish authorization path.

Choosing among the supported providers

There is no documented benchmark that ranks GitHub Actions, GitLab CI/CD, or CircleCI for security or reliability. Make the choice from operational fit:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Decision point Questions to answer
Runner eligibility Does the release run on a currently supported hosted runner rather than a self-hosted runner?
Identity matching Can the team reliably maintain the provider-specific repository, workflow, project, pipeline, environment, and context fields?
Provenance Is the repository public and is automatic provenance required? GitHub and GitLab currently support qualifying attestations; CircleCI does not automatically generate them.
Release control Does the provider support the team’s approval gates, protected tags, and staged-release process?
Version management Can every release runner use the required npm and Node versions, including newer versions for trust management or dist-tags?

Practical go-live checklist

  • Confirm the package is using a supported provider and hosted runner.
  • Install npm 11.5.1 or later and Node.js 22.14.0 or later; use npm 11.15.0 or later for npm trust.
  • Register the exact provider identity fields, observing case sensitivity.
  • Choose direct publish, staged publish, and dist-tag permissions separately.
  • Enable the provider’s OIDC token request permission.
  • Run the first successful publish within two days of creating the entry.
  • Test the real publish path rather than npm whoami.
  • Keep a separate read-only credential for private dependency installation.
  • Protect release tags, deployment environments, workflow files, and production triggers.
  • Revoke obsolete publish tokens and review the trusted-publisher list regularly.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

CI/CDCircleCIGitHub ActionsGitLab CI/CDnpmOIDCsoftware supply chaintrusted publishing

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.