Repository navigation
fix(npm): refuse empty checksum responses instead of skipping verification - #81
Closed
DivyamTalwar wants to merge 1 commit into
Closed
DivyamTalwar wants to merge 1 commit into
DivyamTalwar wants to merge 1 commit into
Conversation
This was referenced Nov 22, 2026
zeekay
added a commit
that referenced
this pull request
Nov 25, 2026
…cher reliability (#92) Consolidates #81, #79, #82, #77, #80, #78, and #76 into a single audited npm installer and launcher update: - Security (#81): refuse empty or malformed .sha256 responses (require 64-hex SHA-256, normalize uppercase), and fail closed on invalid checksums for optional companions too. - Security (#79): use lstatSync in linkAlias and unlink dangling symlinks before try/fallback so copyFileSync can never write through a stale symlink. - Integrity (#82): extract standard tools in an isolated staging dir, reject missing/empty/directory/symlink placeholders, unlink existing destination entries before cpSync (preventing macOS cpSync abort on dangling symlinks and Linux ETXTBSY), preserve sidecar files, and keep prior installs intact on failure. - Cleanup (#77): remove temporary downloaded archives in finally on all error paths. - Reliability (#80): reject missing or flag-shaped values for -m/--model/-p/--port/--overlay in ENGINE_ADAPTER instead of infinite-looping; export ENGINE_ADAPTER. - Reliability (#78): require regular executable files (not directories or non-executable files) on PATH in realBinary() and hasLocal(); isolate PATH in launcher-presence tests. - Reliability (#76): propagate native child termination signals (mapping SIGUSR1/SIGPIPE to 128+sig instead of invoking Node inspector or ignoring SIGPIPE), treat missing status as 1, preserve 0755 mode on npm/bin/hanzo.js, and run all npm/*.test.js in Makefile test target. Co-authored-by: Hanzo Dev <[email protected]>
Member
|
Audited, hardened, and consolidated with #76–#82 into #92, merged into |
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.
Problem
The npm installer treats a
200 OKresponse from a.sha256URL as verified even if that response is empty.want = ""is falsy, soif (want && got !== want)silently skips digest verification and installs the downloaded native binary without checking its checksum.Fix
When a checksum URL is supplied, require a valid 64-hex SHA-256 digest before extracting the archive. Normalize uppercase hex (valid SHA-256 notation) to lowercase for comparison. This does not change the intentional no-checksum fallback used for engine builds that have no checksum asset.
Verified
node --test npm/install.test.js— 7 passed, 3 platform skips, 0 failures (macOS), covering empty checksums, valid uppercase checksums, mismatched checksums, invalid tarballs, and platform handling.node --checkfor both changed files, andgit diff --check, passed.Independent of #77 (temporary file cleanup) and #79 (alias symlink replacement); no dependencies added.