Skip to content

The image installs its pinned npm by unpacking the checked tarball - #2081

Open
zlareb1 wants to merge 2 commits into
mainfrom
fix/scanning-alerts
Open

zlareb1 wants to merge 2 commits into
mainfrom
fix/scanning-alerts

Conversation

@zlareb1

@zlareb1 zlareb1 commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

Not required.

Why

Scorecard's Pinned-Dependencies check flags Dockerfile:110 with "npmCommand not pinned by hash". The image replaces the bundled npm, which carries a vulnerable cross-spawn, with one already checked against its sha256. The check flags the npm install -g /tmp/npm.tgz command whatever came before it.

The registry tarball carries all of its own dependencies, and the Node tarball's bin/npm and bin/npx link to lib/node_modules/npm/bin/*-cli.js. Unpacking the checked tarball into lib/node_modules/npm therefore installs the same files with no npm command. The step now also checks that npm --version matches NPM_VERSION.

zizmor's self-repository note on the two uses: ./.github/workflows/release-check.yml calls in release.yml is not fixed here. The plugin scanner counts only ./ and docker:// as local references, so the $/ form scored as two unpinned third-party actions and failed that check. For a reusable workflow call, ./ already runs the caller's commit, so the $/ form adds no protection there.

Scope and risk

This changes the npm step of the image's node-builder stage. Nothing else changes.

Compatibility, rollout and rollback

  • Wire: none.
  • Operator steps: none.
  • Rollback: reverting leaves nothing behind.

Tests

  • docker build --target node-builder . (arm64) passed, including the npm ci of the code toolchains with the new npm. In the built stage, npm --version and npx --version print 11.21.3, and npm ls -g lists corepack and npm@11.21.3. No cross-spawn package is left under lib/node_modules, and the files are owned by root.
  • The first push also switched the two release calls to $/. The plugin scanner then scored 72 against its minimum of 75, so this PR keeps ./.
  • The 22 unit test files that read the root Dockerfile or release.yml: 532 passed. One failed, test_compose_extractor_service, because the reference extractor service answered 500 in the local environment. That test reads extractor/Dockerfile and compose files, which this change does not touch.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code. I checked the image build and the alert lines myself.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Local format, lint, type checks and focused tests pass. The full make test-unit and applicable integration results are reported by CI; a full local run is not required before pushing.
  • Generated files are regenerated in this PR, not by hand: none are affected.
  • A new migration is additive and numbered after the latest on main; no merged migration is edited. (No migration.)
  • A behaviour change to any file a plugin ships bumps both plugin manifests' version. (No plugin file.)
  • The frontend builds and its tests pass, if frontend/ changed. (Not changed.)
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers.
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.
  • I signed the Contributor License Agreement (CLA) if CLA assistant requested a signature.

🤖 Generated with Claude Code


Note

Low Risk
CI-only Docker build change in the node-builder stage; no runtime wire or application behavior changes beyond how npm is laid down in the image.

Overview
The node-builder stage no longer runs npm install -g to layer the pinned npm tarball on top of Node. After the same sha256-checked download, it removes the bundled npm tree, unpacks the registry tarball directly into lib/node_modules/npm (so existing bin/npm / bin/npx symlinks still work), and asserts npm --version equals NPM_VERSION.

Comments in the Dockerfile now explain that manual unpack avoids an unpinned npm invocation while keeping the CVE-motivated pinned npm replacement.

Reviewed by Cursor Bugbot for commit 104dd68. Bugbot is set up for automated code reviews on this repo. Configure here.

…release-check from its own commit

Scorecard's Pinned-Dependencies check flags any npm install command, even after a sha256 check, so the image now unpacks the checked npm tarball into lib/node_modules/npm. zizmor's self-repository audit asks for the $/ form of a same-repository reusable workflow call, which runs the caller's commit as ./ does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
@vercel

vercel Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
loom-docs Ready Ready Preview Dec 3, 2026 11:51am UTC
loom-telemetry Ready Ready Preview Dec 3, 2026 11:51am UTC

Request Review

The plugin scanner counts only ./ and docker:// as local action references, so the $/ form scored as two unpinned third-party actions and dropped the scan below its threshold. For a reusable workflow call, ./ already runs the caller's commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
@zlareb1 zlareb1 changed the title The image installs its pinned npm by unpacking it, and release calls release-check from its own commit The image installs its pinned npm by unpacking the checked tarball Dec 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant