Skip to content

fix(ci): pin npm exactly and drop obsolete npm upgrade steps - #10651

Merged
ThatOneBro merged 1 commit into
mainfrom
fix/ci-pin-dependencies
Sep 24, 2026
Merged

ThatOneBro merged 1 commit into
mainfrom
fix/ci-pin-dependencies

Conversation

@ThatOneBro

Copy link
Copy Markdown
Member

Addresses the OpenSSF Scorecard Pinned-Dependencies alerts that relate to CI and release tooling.

Changes

Alert Location Change
#485 .github/workflows/publish.yml npm install -g npm@11 → [email protected]
#490 .github/workflows/prepare-release.yml Removed the obsolete "Upgrade NPM" step
#491 .github/workflows/upgrade-dependencies.yml Removed the obsolete "Upgrade NPM" step
#420 scripts/deploy-bot-layer.sh Added --ignore-scripts to the Bot Lambda layer install

#485 — npm@11 is a floating range. The install runs inside the publish job, which holds id-token: write and the npm trusted-publishing identity, immediately before npm publish --provenance. 11.19.1 is the newest 11.x that clears this repo's own 7-day minimumReleaseAge policy (11.20.0 shipped 2026-09-22). Both existing constraints still hold: >= 11.5.1 for trusted publishing, < 12 because npm 12 dropped the bundled sigstore that --provenance needs (npm/cli#9722).

#490 / #491 — Both steps installed [email protected] to work around npm/cli#8690, a lockfile peer attribute bug in the npm 11.6.2 that Node 24 used to bundle. The inline comment said to remove the step once Node shipped npm 11.6.3 or later. That happened in Node v24.13.1 (npm 11.8.0), and v24.21.0 — what setup-node with node-version: '24' resolves to today — bundles npm 11.19.0. The step was no longer just redundant: it was downgrading npm by twelve minor versions right before regenerating package-lock.json.

#420 — deploy-bot-layer.sh builds the production Bot Lambda layer that customer bots run on. It copies packages/bot-layer/package.json into a temp dir and runs npm install with no lockfile, in jobs (publish.yml, staging.yml) that hold AWS deploy credentials, so every transitive dependency resolves fresh and its lifecycle scripts run. --ignore-scripts is safe here: the only package in the tree with an install script is ssh2, whose script only builds its native addon when the optional cpu-features/nan deps are present, and --omit=optional already excludes them.

Verified

  • Every uses: reference across .github/workflows/ and .github/actions/ is already SHA-pinned (38 distinct refs; the only non-SHA uses: is the local reusable workflow ./.github/workflows/vouch-check-pr-shared.yml). No changes needed.
  • prettier --check passes on all four touched files. Unrelated pre-existing formatting failures elsewhere were left alone.
  • bash -n scripts/deploy-bot-layer.sh passes.

Deliberately not addressed

These can be dismissed in the Scorecard UI with the reasons below.

Full lockfile pinning for the bot layer (#420) would need a committed packages/bot-layer/npm-shrinkwrap.json and npm ci. That is a larger change, complicated by the lockfile having to reference @medplum/* versions that are not published yet at prepare-release time, so it is left for a follow-up.

🤖 Generated with Claude Code

OpenSSF Scorecard's Pinned-Dependencies check flags several unpinned
install commands in CI. Three of them are worth fixing rather than
dismissing.

publish.yml installed `npm@11`, a floating range that currently resolves
to 11.20.0. That install happens inside the publish job, which holds
`id-token: write` plus the npm trusted-publishing identity, and runs
immediately before `npm publish --provenance`. A compromised or simply
broken npm 11.x release would execute there with no review. Pin the
exact version instead. 11.19.1 is the newest 11.x that satisfies the
repo's own 7-day `minimumReleaseAge` policy; 11.20.0 shipped yesterday.
The existing constraints still hold: >= 11.5.1 for trusted publishing,
< 12 because npm 12 dropped the bundled `sigstore` that `--provenance`
needs (npm/cli#9722).

prepare-release.yml and upgrade-dependencies.yml each installed
[email protected] to work around npm/cli#8690, a lockfile `peer` attribute bug
in the npm 11.6.2 that Node 24 used to bundle. The comment said to
remove the step once Node shipped npm 11.6.3 or later; that happened in
Node v24.13.1 (npm 11.8.0), and v24.21.0 (what `setup-node` with `node-version: 24`
resolves to today) bundles npm 11.19.0. The step is therefore not just
obsolete, it actively downgrades npm by twelve minor versions before
regenerating the lockfile. Removing it uses the npm that ships with the
pinned Node and clears the alerts.

deploy-bot-layer.sh builds the production Bot Lambda layer that customer
bots execute on. It runs `npm install` against a copied package.json
with no lockfile, in a job that holds AWS deploy credentials, so every
transitive dependency resolves fresh and its lifecycle scripts run. Add
`--ignore-scripts`. Nothing in the tree needs one: ssh2's install script
only builds its native addon when the optional `cpu-features`/`nan` deps
are present, and `--omit=optional` already excludes them.

Signed-off-by: Derrick Farris <[email protected]>
@ThatOneBro
ThatOneBro requested review from a team as code owners September 23, 2026 23:24
@vercel

vercel Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
foomedical Ready Ready Preview Sep 23, 2026 11:27pm UTC
medplum-provider Ready Ready Preview Sep 23, 2026 11:27pm UTC
2 Skipped Deployments
Project Deployment Actions Updated
medplum-app Ignored Ignored Sep 23, 2026 11:27pm UTC
medplum-www Ignored Ignored Sep 23, 2026 11:27pm UTC

Request Review

@sonarqubecloud

Copy link
Copy Markdown

Comment on lines -35 to -40
# npm 11.6.2 is currently bundled with Node v24 and has an irksome bug affecting
# `peer` attributes in the lockfile (https://github.com/npm/cli/issues/8690).
# Upgrade to a patched version; this should be removed after Node has a tagged
# release incorporating [email protected] or later.
- name: Upgrade NPM
run: npm install --global [email protected]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this! I meant to remove it a ways back but it fell off my radar. Oops!

@ThatOneBro ThatOneBro added this to the September 30, 2026 milestone Sep 24, 2026
@ThatOneBro ThatOneBro moved this to 👀 In review in Medplum Product Roadmap Sep 24, 2026
@ThatOneBro
ThatOneBro added this pull request to the merge queue Sep 24, 2026
Merged via the queue into main with commit 44ccb14 Sep 24, 2026
39 checks passed
@ThatOneBro
ThatOneBro deleted the fix/ci-pin-dependencies branch September 24, 2026 16:47
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in Medplum Product Roadmap Sep 24, 2026
pull Bot pushed a commit to Zezo-Ai/ZezoAi-medplum that referenced this pull request Sep 24, 2026
## What's Changed

* feature(dw): remove the data warehouse from the OSS repo. (medplum#10640)
* fix(server): add file extension to vite seed config import (medplum#10540)
* fix(ci): pin npm exactly and drop obsolete npm upgrade steps (medplum#10651)
* feat(server): write a history tombstone on $expunge (medplum#10436)
* Lift ScheduleAvailabilityEditor's state so a parent form can hold it (medplum#10642)
* Remove dotenv and dependency cleanup (medplum#10654)
* [SchedulingWorkspace] Cancel appointment adjustments (medplum#10657)

**Full Changelog**: medplum/medplum@v5.1.40...v5.1.41

Signed-off-by: Medplum Bot <[email protected]>

This branch was successfully deployed

2 active deployments
Preview – foomedical — f9f0b172 Deployed Sep 23, 2026 by vercel[bot]
Preview – medplum-provider — f9f0b172 Deployed Sep 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants