Skip to content

security: keep tar 7 out of the Docker image and record the new tar advisories - #466

Closed
italomacedo wants to merge 2 commits into
mainfrom
fix-tar7-advisories
Closed

italomacedo wants to merge 2 commits into
mainfrom
fix-tar7-advisories

Conversation

@italomacedo

@italomacedo italomacedo commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The tar 7 advisories published on 2026-12-02 (CVE-2026-140240, CVE-2026-140244 and others) make node utilities/audit-check.js --audit-level=high fail. FHIRsmith's own tar is already 8; the vulnerable copies come from sqlite3 6.0.1, node-gyp and @mapbox/node-pre-gyp 2.0.3 (under roaring). There is no patched tar 7, and none of those packages has a release on tar 8 yet.

What this does

  • Dockerfile: removes those three nested tar 7 copies after npm ci, since they are only used while installing. The build fails if any tar older than 8 is left in node_modules.
  • audit-allowlist.json: adds the remaining tar <8 advisories, with the same expiry as the existing entry (2027-03-01).
  • CHANGELOG.md: entry under Security.

This is a mitigation, not a full fix: installs from npm or from a clone still get tar 7 under those packages. The allowlist entries are your call; drop or shorten them as you see fit.

Why not an npm override to tar 8

I tried "overrides": { "tar": "$tar" }. @mapbox/node-pre-gyp calls tar.extract() as a stream, which tar 8 no longer accepts, so installing roaring fails (TypeError: extract needs input or file). node-gyp uses the same call when it downloads headers. Overriding only sqlite3 also moved node-gyp to tar 8, so I left the dependency tree alone.

Verification

  • docker build succeeds.
  • In the built image, sqlite3, roaring and bcrypt load, the only tar in /app/node_modules is 8.0.5, and the server starts with a minimal configuration.
  • npm audit, filtered by the new allowlist, has nothing left at high or above, and nothing at moderate or above with --omit=dev.

Unrelated test fix, needed for green checks

Test (2/2) was failing on four FHIRPath tests, with or without this change. FHIR/fhir-test-cases#350 (merged 2026-12-02) added htmlTest05-07, which call .text.div.htmlChecks() on a Bundle, and parser.js treats div as a keyword. The second commit adds the three expressions to the "parser is stricter than Java" lists, next to the existing text.div.htmlChecks(). Whether the parser should accept .div instead is your call. With the latest test cases, both FHIRPath suites pass locally (1468 tests).

Not covered

The node:24-alpine base image ships npm with its own bundled tar (7.5.22 in the image I built), outside /app. Removing npm from the runtime stage would address that, but it changes what is available in the container, so I did not do it here.

🤖 Generated with Claude Code

italomacedo and others added 2 commits December 3, 2026 10:44
…dvisories

sqlite3, node-gyp and @mapbox/node-pre-gyp still depend on tar 7, which has no
patched release. They use it only while installing, so the Dockerfile removes
those copies after npm ci and fails the build if any tar older than 8 is left in
node_modules. The tar 7 advisories published on 2026-12-02 are added to
audit-allowlist.json so that npm audit in CI fails only on something new.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
fhir-test-cases added htmlTest05-07 (FHIR/fhir-test-cases#350, merged
2026-12-02), which call .text.div.htmlChecks() on a Bundle. div is a keyword in
this parser, as for the existing text.div.htmlChecks() case.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@grahamegrieve

Copy link
Copy Markdown
Contributor

closing this as the approach from Josh was a little more thorough

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.

2 participants