Skip to content

Commit c260cb8

Browse files
committed
fix(publish-cross-org): drop NPM_TOKEN fallback, trusted-publishing only
The workflow had a NODE_AUTH_TOKEN env wired to secrets.NPM_TOKEN as a fallback path for repos with a long-lived npm token. That defeats the trust gate the topology depends on: - trusted-publishing minted via this workflow's `id-token: write` permission, scoped to (sourceRepo, workflowPath) on npmjs.com. - A long-lived NPM_TOKEN is scoped to the npm account — anyone who exfiltrates the secret gets publish rights for the whole scope, no workflow binding, no SHA pin, no expiry. The two auth paths can coexist on npm's side, but having BOTH wired here means a token leak goes undetected (publishes succeed via the fallback even when the OIDC config is broken). Trusted-publishing is the only auth path now; if npm rejects the OIDC token, the publish fails loudly — which is the correct failure mode. Per-package trusted-publisher config on npmjs.com must point at SocketDev/socket-addon + this workflow before any real publish goes through. The first dispatch will reveal whether that's configured.
1 parent 4caf99f commit c260cb8

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

.github/workflows/publish-cross-org.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,13 @@ jobs:
6969
# gh CLI inherits its token from GITHUB_TOKEN; this binding is
7070
# explicit so the publish.mts subprocess inherits it too.
7171
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72-
# NODE_AUTH_TOKEN is what npm publish reads. The provenance
73-
# path mints a workflow-OIDC token; this fallback is for
74-
# repos using a long-lived token.
75-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
72+
# Auth is trusted-publishing only: `npm publish --provenance`
73+
# mints an OIDC token from this workflow's `id-token: write`
74+
# permission and npm verifies against the package's trusted-
75+
# publisher config (configured per-package on npmjs.com,
76+
# pointing at SocketDev/socket-addon + this workflow path).
77+
# No NPM_TOKEN env on purpose — a long-lived token would
78+
# widen the trust gate.
7679
run: node scripts/publish-cross-org.mts
7780

7881
- name: Summarize publish

0 commit comments

Comments
 (0)