Repository navigation
ci(release): run on Node 22 with registry-pinned npm (INF-864) - #974
dylanschmittle-uniswap wants to merge 1 commit into
Conversation
|
|
||
| - name: Install npm | ||
| run: npm install -g github:npm/cli#6d1db8724b1d0e5457a87bb31e62e43d566348ce --ignore-scripts # npm@11.7.0 | ||
| run: npm install -g npm@11.6.3 --ignore-scripts |
There was a problem hiding this comment.
🟡 Medium severity blocking issue identified in your code:
npm@11.6.3 --ignore-scripts
An npm script inside an action on GitHub is not pinned to a full length commit SHA. Pinning the npm package to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.
To resolve this comment:
✨ Commit fix suggestion
| run: npm install -g npm@11.6.3 --ignore-scripts | |
| # Replace with the verified 40-character commit SHA for the official npm@11.6.3 release. | |
| run: npm install -g npm@git+https://github.com/npm/cli.git#<VERIFIED_VALUE_REQUIRED> --ignore-scripts |
View step-by-step instructions
-
Identify the full 40-character Git commit SHA in the
npm/clirepository that corresponds to thenpm@11.6.3release. -
Replace the version-based installation with the immutable Git reference:
run: npm install -g npm@git+https://github.com/npm/cli.git#<40-character-commit-sha> --ignore-scripts -
Keep
--ignore-scriptsenabled so package lifecycle scripts do not execute during the global installation. -
Confirm that the selected commit is the official
npm@11.6.3release commit, rather than a branch or tag, before using it in the workflow.
💬 Ignore this finding
Reply with Semgrep commands to ignore this finding.
/fp <comment>for false positive/ar <comment>for acceptable risk/other <comment>for all other reasons
Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by npm-package-in-action-not-pinned-to-commit-sha.
You can view more details about this finding in the Semgrep AppSec Platform.
Summary
node-version20 ->"22.23.4"(npm trusted publishing needs Node >= 22.14; matches Uniswap/default-token-list#2661).npm install -g github:npm/cli#<sha>install with registry-pinnednpm install -g npm@11.6.3 --ignore-scripts(same pin as the other repos).setup-nodehas nocache:, noactions/cache), so nothing to remove..github/workflows/release.ymlchanges.Linear: INF-864 (part of INF-859, npm OIDC/2FA hardening)
Validation
zizmorv1.33.1 offline on the workflow: before = 1 lowadhoc-packages(the git-sha npm install, 4 suppressed); after = still 1 lowadhoc-packageson thenpm@11.6.3line (4 suppressed), 0 medium/high. Same rule at the same step; it flags any global install outside a lockfile, so it is not new and not made worse.npm view npm@11.6.3 versionreturns 11.6.3; Node 22.23.4 verified on nodejs.org dist.Test plan
workflow_dispatch) and confirm the published version shows_npmUser.trustedPublisherand provenance on the npm registry.