ci(after-merge): Enable npm OIDC trusted publishing on dev-canary#12683
Open
usmanmani1122 wants to merge 1 commit into
Open
ci(after-merge): Enable npm OIDC trusted publishing on dev-canary#12683usmanmani1122 wants to merge 1 commit into
usmanmani1122 wants to merge 1 commit into
Conversation
turadg
approved these changes
May 23, 2026
Member
turadg
left a comment
There was a problem hiding this comment.
(4.10.0+ adds dry-run OIDC verification, but we're intentionally on 4.9.4.)
Updating the patch for 4.10 seems worth getting the dry run but I'll leave the operational risk trade-offs to you.
| "name": "@agoric/client-utils", | ||
| "version": "0.1.0", | ||
| "description": "Utilities for building Agoric clients", | ||
| "repository": { |
Member
There was a problem hiding this comment.
these package.json changes should have been a chore commit separate from the ci one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
refs: #XXXX
Description
Enables npm OIDC trusted publishing on the
dev-canaryjob in.github/workflows/after-merge.yml, and fixes one prerequisite in package metadata. This is the second of two PRs:@lerna-lite/*to~4.9.0for OIDC support #12677, merged): bumped@lerna-lite/*to~4.9.0so the publish tool actually implements OIDC.id-token: writepermission, documents the transitional NPM_TOKEN fallback, and alignsrepository.urlacross all 48 publicly-published packages.Changes
1. Workflow (
.github/workflows/after-merge.yml) — adds a job-levelpermissionsblock todev-canary:Once
id-token: writeis granted,@lerna-lite/publish(≥4.9.0) automatically:ACTIONS_ID_TOKEN_REQUEST_URL/ACTIONS_ID_TOKEN_REQUEST_TOKENenv vars.https://registry.npmjs.org/-/npm/v1/oidc/token/exchange/package/${pkg}.The existing
configure NPM tokenandcheck credentialssteps are intentionally kept as transitional fallback (see "Why we keep NPM_TOKEN" below).2.
repository.urlfixes (12 packages) — npm trusted publishing uses the package'srepositoryfield to issue provenance attestations and to cross-check the GitHub origin. Audit findings:repositoryfield at all:@agoric/client-utils,@agoric/eslint-plugin,@agoric/fast-usdc,@agoric/internal,@agoric/pola-io,@agoric/portfolio-api,@agoric/swingset-xsnap-supervisor,@agoric/vow,@agoric/wallet,@agoric/xsnap,@agoric/xsnap-lockdown.@agoric/smart-wallet→git+https://github.com/Agoric/agoric(now corrected toAgoric/agoric-sdk).All 12 are now set to the canonical object form used by the majority of public packages:
Inserted just after
description(orversionif no description) — the position used by the most idiomatic existing packages. Existing packages that already use the string shorthand ("repository": "https://github.com/Agoric/agoric-sdk") are not touched; npm normalizes both forms to the same canonical URL.After this change all 48 publicly-published packages have a
repository.urlmatchinggithub.com/Agoric/agoric-sdk.Prerequisite (out of band, not part of this PR)
For OIDC to take effect for a given package, a Trusted Publisher must be configured on npmjs.com:
Agoricagoric-sdkafter-merge.ymlnpm publishUntil that config exists for a package, OIDC silently falls back to
NPM_TOKEN. Configuration is per-package — 48 publicly-published packages underpackages/*(everypackage.jsonwithout"private": true).Why we keep NPM_TOKEN as a fallback
Verified in
@lerna-lite/publish@4.9.4source (packages/publish/src/lib/oidc.ts:134-147): the per-package/oidc/token/exchangecall is wrapped in a try/catch that returnsundefinedon any non-2xx response without mutatingopts/config. The caller inlib/npm-publish.ts:56-62does not check the return value, so the subsequentlibnpmpublish.publish()call uses whatever_authTokenis already on the registry config — i.e., the~/.npmrcline written by ourconfigure NPM tokenstep.Failure path → silent fallback:
verbose oidc Failed token exchange request ...(visible at--loglevel verbose).This means we can:
Files changed
.github/workflows/after-merge.yml— addspermissions:block ondev-canaryjob; two short inline comments explaining the OIDC enablement and the transitional fallback.packages/{client-utils,eslint-plugin,fast-usdc,internal,pola-io,portfolio-api,swingset-xsnap-supervisor,vow,wallet,xsnap,xsnap-lockdown}/package.json— add canonicalrepositoryfield.packages/smart-wallet/package.json— replace staleAgoric/agoricrepository.urlwith the correctAgoric/agoric-sdkURL, normalize placement.Security Considerations
This PR reduces the long-term attack surface:
agoricbotis stored asNPM_TOKENsecret. Compromise of the secret = ability to publish any of the 48 packages until manually revoked.Transitional state (this PR + NPM_TOKEN coexisting): identical risk profile to today, because the granular token is still present. OIDC adds an additional, per-package, short-lived credential path that is preferred when available.
The
permissions:block is scoped to thedev-canaryjob, not workflow-wide —id-token: writeis not granted to thebuild,coverage, orbenchmarkjobs. Oncepermissions:is declared, all unlisted permissions becomenonefor that job (least-privilege default), socontents: readis explicit foractions/checkout.The
repository.urlfix on@agoric/smart-walletcorrects a long-standing stale reference — no security implication beyond ensuring provenance attestations point at the right repo.Scaling Considerations
None. Adds one HTTPS round-trip per published package to
registry.npmjs.org/-/npm/v1/oidc/token/exchange/.... The publish concurrency is already 1 (--concurrency 1, gated on agoric-sdk#8091), so the extra latency is roughly 48 × ~100ms = a few seconds per release.Documentation Considerations
The
permissions:block carries an inline comment pointing at the fallback behavior. No external documentation change is needed yet — once NPM_TOKEN is fully removed, the rollback playbook in any internal release docs (if it references the granular token) should be updated.Testing Considerations
This workflow runs only on push to
master,release-*, ordev-*. CI verification options:@lerna-lite/publish4.9.x verifies OIDC against the live registry only at publish time. (4.10.0+ adds dry-run OIDC verification, but we're intentionally on 4.9.4.)dev-canaryjob logs. With--loglevel verboseonlerna publish(consider a follow-up if signal is needed), look for:verbose oidc Successfully retrieved oidc token from package ...→ OIDC working for that package.verbose oidc Failed token exchange request ...→ fallback to NPM_TOKEN; trusted publisher not yet configured.Upgrade Considerations
~/.npmrc_authTokenwritten byconfigure NPM tokenis global to the runner for the duration of the job; if any other step in the job spawnsnpm publishindependently, it would also use NPM_TOKEN, not OIDC. Currently nothing else publishes from this job.configure NPM tokenandcheck credentialssteps, drop theNPM_TOKENGitHub Actions secret, and delete theagoricbotgranular access token on npmjs.com.