CEXT-6301: fix CI registry auth to prevent npm token exposure#474
Merged
Conversation
|
… setup-node token
Member
Author
|
publish-internal publish-preview
publish-public will be tested in the next public release. |
iivvaannxx
approved these changes
May 28, 2026
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.
Description
Fixes a security issue where a plaintext npm auth token was committed to git by the CI release workflow, then refactors the publish infrastructure to prevent the same class of issue from recurring.
Auth fix (
fix CI release auth writing token to workspace .npmrc):prepare.tswas writing the npm registry token as a plaintext value to$GITHUB_WORKSPACE/.npmrc. After a separate commit removed the checked-in.npmrcfrom the repo, that file became untracked in the workspace.changesets/actionrunsgit add -Ainternally when creating a version PR, which committed the file — and the token — tochangeset-release/release.The fix removes all manual
.npmrcmanipulation.setup-releasenow runssetup-nodewithout any registry configuration (clean install from public npm), then writes only a${NODE_AUTH_TOKEN}placeholder entry to$HOME/.npmrcafter install — no token value is ever written to any file in any git-reachable path.NODE_AUTH_TOKENis injected via$GITHUB_ENVso it is available to all subsequent steps without being committed anywhere.Publish registry decoupling: The root cause also exposed an architectural gap — the publish destination (npm vs Artifactory) was implicit, determined by which
.npmrcentries happened to be active at publish time. This PR makes it explicit:publishConfig.registry: "https://registry.npmjs.org"andpublishConfig.access: "public", sopnpm changeset publishalways targets npm by defaultpublish-snapshotaction overrides these fields at CI time usingnpm pkg set --prefixbefore publishingsetup-nodeno longer receivesregistry-urlorscope— this previously causedERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION404s because pnpm's supply-chain check queried Artifactory for public@adobe/aio-lib-*packages that don't exist thereWorkflow refactor (
replace shared workflow with composite actions): The oldpublish-shared.ymlreusable workflow was called by all three publish workflows with channel-specific parameters. Understanding any single release path required tracing through both the caller and the callee. Replaced with three composite actions that each workflow inlines directly:.github/actions/setup-release— pnpm, Node.js, install, publish auth.github/actions/publish-snapshot— changeset status, snapshot version, registry override, build, publish.github/actions/notify-slack— generate Slack announcement, post via webhookEach publish workflow is now self-contained and readable end-to-end.
Further cleanup:
prepare.ts— the function always ran in snapshot contextpublish-internal.ymlmirrorjob frompublish-public.yml— no longer needed sincepublishConfig.registrymakes the publish destination explicit per-packageRelated Issue
https://jira.corp.adobe.com/browse/CEXT-6301
Motivation and Context
A plaintext npm registry token was committed to a branch in this repo. Root cause:
prepare.tswrote the auth token to$GITHUB_WORKSPACE/.npmrc.npmrc(making it untracked)changesets/actionusesgit add -Ainternally — it committed the untracked.npmrcwith the token tochangeset-release/releaseThe token was rotated immediately after discovery. This PR ensures the same pattern cannot recur by removing all plaintext token writes from CI.
How Has This Been Tested?
Unit tests —
prepare.tstests updated and passing:pnpm --filter @aio-commerce-sdk/scripts test pnpm typecheckWorkflow test plan (run before merging):
GitHub resolves relative composite action paths (
uses: ./.github/actions/…) from the same branch the workflow runs on. All dispatch-capable workflows can therefore be tested from this branch before merge.Step 1 —
publish-internal✅Actions → Publish Internal → Run workflow → branch
ci/release-prep,Notify in Slack: false.Verified: install passes with no 404, snapshot packages published to Artifactory.
Step 2 —
publish-preview(in progress)PR #475 (
test/preview-ci → ci/release-prep) was created as a test target — it branches fromci/release-prep(so the action files are present at the PR HEAD) and contains a changeset.Actions → Publish Preview → Run workflow → branch
ci/release-prep, PR475.Verify:
preparejob resolves the PR head SHA and finds the changesetreleasejob completes and publishes snapshot packagescommentjob posts the package table to PR test: publish-preview CI test #475 withalphatagStep 3 —
publish-publicCannot be triggered in isolation (requires a real release). The
mirrorjob has been removed; public packages now publish directly to npm viapublishConfig.registry. Verify at the next scheduledpublish-publicrun after merge.Screenshots (if appropriate):
N/A
Types of changes
Checklist: