build: verify pnpm tarball against the packageManager sha512 pin - #4952
Merged
Conversation
The corepack replacement in #4948 installed pnpm by version only, dropping the integrity check corepack performed against the +sha512 suffix of the `packageManager` field. Download the tarball with `npm pack`, check it against the pin (the pin is the sha512 hex digest of the npm tarball), and install from the verified file. The tarball is removed after install so the final stage's *.tgz glob keeps matching only the packed commitlint packages. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Confidence Score: 5/5The PR appears safe to merge, with no actionable defects identified in the changed container-build path. The checksum verification is fail-closed, installation occurs only after verification, and the temporary pnpm tarball is removed before later package artifacts are generated.
|
| Filename | Overview |
|---|---|
| Dockerfile.ci | Adds fail-closed SHA-512 verification for the pinned pnpm tarball and cleans it up before the existing package glob is used. |
Reviews (1): Last reviewed commit: "build: verify pnpm tarball against the p..." | Re-trigger Greptile
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
Follow-up to #4948: the container build now verifies the pnpm tarball against the
+sha512suffix of thepackageManagerfield before installing it —npm packthe pinned version,sha512sum -cagainst the pin, install from the verified file, remove the tarball so the final stage's*.tgzglob keeps matching only the packed commitlint packages.Motivation and Context
Addresses the review comment on #4948: the corepack replacement installed pnpm by version only, dropping the artifact-integrity check corepack performed against the
packageManagerpin. The pin is the sha512 hex digest of the npm tarball, so the same guarantee is restored with stock tooling.Deliberately unchanged: the stock-Ubuntu CI job (
CI.yml) keeps its version-onlynpm install -g pnpm— that job is an intentional "stock environment" smoke test; it can get the same treatment separately if wanted.Usage examples
Not applicable — no runtime behavior changes; published image contents are identical.
How Has This Been Tested?
+sha512value inpackage.jsonis byte-identical to the sha512 ofpnpm-11.21.0.tgzfrom the registry.node:22-alpine: correct pin →pnpm-11.21.0.tgz: OK, install proceeds; tampered pin →sha512sumFAILED and the build aborts before installing anything.Dockerfile.cibuild from a pristine clone of this branch: green end-to-end, checksumOKin the build log. The final-stage layers (includingCOPY --from=builder /src/*.tgz) cache-hit against the previous green build, confirming the produced tarball set — and therefore the published image — is unchanged.Types of changes
Checklist:
🤖 Generated with Claude Code