Repository navigation
Install tar 8 under sqlite3, node-gyp and node-pre-gyp (clone and Docker installs) - #468
Merged
Merged
Conversation
…rough a small shim
tar 7 has open advisories that are fixed only in tar 8. sqlite3, node-gyp and
@mapbox/node-pre-gyp still ask for tar 7, and two of their calls changed in tar 8,
so a plain override to tar 8 breaks installs that build from source or download a
prebuilt binary.
vendor/tar-stream-shim is tar 8 with those two call forms restored
(extract() with no file returning a writable stream, and extract({sync: true})).
package.json overrides point the three packages at it, so the only tar code in
node_modules is tar 8.
The lock file changes only in the tar entries. The Dockerfile copies the shim in
before npm ci. The Install check workflow installs on Linux, macOS and Windows,
checks no tar older than 8 is present, loads the native modules and builds
sqlite3 from source.
Co-Authored-By: Claude <noreply@anthropic.com>
npm 12 (and recent npm 11) runs a dependency's install script only when the project approves it in package.json allowScripts. Without that, npm install finishes without error and these three packages have no native binary, so the server cannot open a database. Older npm ignores the field. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
When tar stopped reading part way (not an archive, a bad entry), the stream handed to node-gyp and node-pre-gyp waited for a drain that never came, so a failed download hung the install instead of failing it. The error now destroys the stream. Also treat tar's f alias as file. Co-Authored-By: Claude <noreply@anthropic.com>
… the overrides cover npm doesn't apply a package's overrides when it is installed from the registry, so npm install fhirsmith still gets tar 7 under sqlite3, node-gyp and node-pre-gyp. The fresh install audit has its own allowlist for that (audit-allowlist-published.json), and audit-check.js takes an entry for a whole package, so the next tar 7 advisory doesn't fail a check nothing can be done about. The changelog and vendor/README.md say the overrides cover a clone and the Docker image only. vendor/ is left out of the published package, and the Install check fails if the packed shim and its source differ. Co-Authored-By: Claude <noreply@anthropic.com>
…pprove bcrypt's install script Git for Windows' tar could not open the runner's temp folder. bcrypt carries prebuilt binaries, and its install script builds it where there is none. The allowScripts and engines changelog entries move from Security to Changed. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
grahamegrieve
merged commit Dec 4, 2026
3dbcf78
into
HealthIntersections:main
10 of 11 checks passed
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.
tar 7 has 19 open advisories that are fixed only in tar 8. FHIRsmith's own use of tar is already on 8, but
sqlite3,node-gypand@mapbox/node-pre-gyp(the last two come withroaring) each still depend on tar 7, and none has a release on tar 8. This gives them tar 8 for a clone and for the Docker image.What it does
"overrides": { "tar": "$tar" }alone doesn't work, because tar 8 changed two calls they make:extract()with no file returned a stream and now returns a Promise (node-gyp and node-pre-gyp pipe a download into it, so roaring fails to install), andextract({ sync: true })is no longer synchronous (sqlite3's from-source build then leaves aVERSIONfile that hides the C++<version>header on macOS and Windows).vendor/tar-stream-shimis tar 8 with those two calls as they were, about 40 lines; package.jsonoverridesinstalls it astarunder the three packages.vendor/README.mdhas the details and how to remove it once they move to tar 8.allowScriptsfor sqlite3, better-sqlite3, roaring and bcrypt. npm 12 (and recent npm 11) only runs the install scripts a project approves; without this,npm installleaves the first three without a native binary and reports no error.engines: ^24. roaring 2.7.0 has no prebuilt binary for Node 26 and does not compile there (V8 API removals). As an optional dependency it is skipped silently, and the sqlite-v2 providers then can't load. The README says the same.audit-allowlist.jsonis empty again. The fresh-install audit step gets its own list,audit-allowlist-published.json, andutilities/audit-check.jstakes an entry for a whole package (with a test).vendor/change): on Linux, macOS and Windows,npm ci, no tar older than 8 installed, the native modules load, sqlite3 builds from source, and the packed shim matches its source.What it doesn't do
npm doesn't apply a package's
overrideswhen that package is installed from the registry, sonpm install fhirsmithstill gets tar 7 under the three packages. Nothing in this repository can change that; it goes away when they release on tar 8. The changelog says so, and the fresh-install audit acceptstarthere with the reason and an expiry (2027-03-01). The three use tar only while installing, on archives from fixed sources.Tested
npm cion npm 11 (Node 24) and npm 12; sqlite3 and roaring built from source through the shim;npm auditclean at high, and at moderate with--omit=dev; the fresh-install audit step exits 0 with 19 tar advisories accepted; jest 2,612 passed, 84 skipped, 0 failed (run before the last three commits; the audit-check tests were rerun after); Docker image builds with only tar 8.npm install --package-lock-only,npm versionfollowed by it (the release steps), and adding a package all work on npm 11 and npm 12 and keep the three shim entries.The PR pipeline's "Run npm audit" step fails on main at present (one allowlisted tar advisory, 19 published); it passes on this branch.
🤖 Generated with Claude Code