From e4a4491236618dd97c1218e6cf8b1f39879e3bc1 Mon Sep 17 00:00:00 2001 From: Italo Macedo Date: Thu, 3 Dec 2026 10:44:04 -0300 Subject: [PATCH 1/2] security: keep tar 7 out of the Docker image and record the new tar advisories 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 --- CHANGELOG.md | 1 + Dockerfile | 5 ++++ audit-allowlist.json | 54 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3507a1b..7c022164 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Security +- Docker image: the tar 7 copies that sqlite3, node-gyp and @mapbox/node-pre-gyp depend on are removed after `npm ci`, as they are only used while installing, and the build fails if any tar older than 8 is left in `node_modules`. The tar 7 advisories published on 2026-12-02 (CVE-2026-140240, CVE-2026-140244 and others) are added to `audit-allowlist.json` until those packages move to tar 8; installs from npm or a clone still get tar 7 under them - Packages are read with tar 8 (was 7, which has 16 high advisories, most of them ways for an archive's links to get out of the folder it is extracted into): the package manager (the tx module's packages) and the packages crawler, which read packages from elsewhere. A package is unzipped against the unpacked size limit as before, and a second layer of compression inside one is now refused ### Added diff --git a/Dockerfile b/Dockerfile index 4278c548..36dbe8eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,11 @@ RUN apk add --no-cache python3 make g++ COPY package*.json ./ RUN npm ci --omit=dev +# sqlite3, node-gyp and @mapbox/node-pre-gyp (the last two for roaring) still depend on tar 7, +# which has no patched release. They only use it while installing, so those copies are left out +# of the runtime image. The check fails the build if any tar older than 8 is left in node_modules. +RUN rm -rf node_modules/sqlite3/node_modules/tar node_modules/node-gyp/node_modules/tar node_modules/@mapbox/node-pre-gyp/node_modules/tar && node -e "const fs=require('fs'),path=require('path');const old=[];(function walk(d){for(const e of fs.readdirSync(d,{withFileTypes:true})){if(!e.isDirectory())continue;const p=path.join(d,e.name);if(e.name==='tar'&&path.basename(d)==='node_modules'){const v=require(path.resolve(p,'package.json')).version;if(Number(v.split('.')[0])<8)old.push(p+'@'+v);}walk(p);}})('node_modules');if(old.length){console.error('tar older than 8 in the image: '+old.join(', '));process.exit(1);}" + # Stage 2: Runtime image (no build tools) FROM node:24-alpine diff --git a/audit-allowlist.json b/audit-allowlist.json index 25e7ce94..d3057322 100644 --- a/audit-allowlist.json +++ b/audit-allowlist.json @@ -2,5 +2,59 @@ "comment": "Advisories the CI npm audit steps accept (utilities/audit-check.js). Each entry needs a reason, and an expiry date after which it fails again so it gets looked at. Remove an entry once a fixed version is installed - the check warns when an entry no longer matches anything.", "advisories": [{ "id": "GHSA-25mm-r35j-6hgm", "until": "2027-03-01", "reason": "tar <8: FHIRsmith's own tar is 8.0.5. The tar 7 copies left are sqlite3 6.0.1's, node-gyp 12's and @mapbox/node-pre-gyp 2.0.3's (under roaring), with no release on tar 8 yet; they use it only while installing, on archives from fixed sources. Remove once they move to tar 8" + }, + { "id": "GHSA-mhqm-9wj8-w7r4", "until": "2027-03-01", + "reason": "Same tar 7 copies as GHSA-25mm-r35j-6hgm: under sqlite3 6.0.1, node-gyp 12 and @mapbox/node-pre-gyp 2.0.3, used only while installing, and removed from the Docker image. FHIRsmith's own tar is 8" + }, + { "id": "GHSA-jmj2-9c5q-vw73", "until": "2027-03-01", + "reason": "Same tar 7 copies as GHSA-25mm-r35j-6hgm: under sqlite3 6.0.1, node-gyp 12 and @mapbox/node-pre-gyp 2.0.3, used only while installing, and removed from the Docker image. FHIRsmith's own tar is 8" + }, + { "id": "GHSA-hqgx-p3r3-2cfg", "until": "2027-03-01", + "reason": "Same tar 7 copies as GHSA-25mm-r35j-6hgm: under sqlite3 6.0.1, node-gyp 12 and @mapbox/node-pre-gyp 2.0.3, used only while installing, and removed from the Docker image. FHIRsmith's own tar is 8" + }, + { "id": "GHSA-gvrf-jx37-rjv5", "until": "2027-03-01", + "reason": "Same tar 7 copies as GHSA-25mm-r35j-6hgm: under sqlite3 6.0.1, node-gyp 12 and @mapbox/node-pre-gyp 2.0.3, used only while installing, and removed from the Docker image. FHIRsmith's own tar is 8" + }, + { "id": "GHSA-6wwr-g865-f46r", "until": "2027-03-01", + "reason": "Same tar 7 copies as GHSA-25mm-r35j-6hgm: under sqlite3 6.0.1, node-gyp 12 and @mapbox/node-pre-gyp 2.0.3, used only while installing, and removed from the Docker image. FHIRsmith's own tar is 8" + }, + { "id": "GHSA-4pf9-5fpx-xmr6", "until": "2027-03-01", + "reason": "Same tar 7 copies as GHSA-25mm-r35j-6hgm: under sqlite3 6.0.1, node-gyp 12 and @mapbox/node-pre-gyp 2.0.3, used only while installing, and removed from the Docker image. FHIRsmith's own tar is 8" + }, + { "id": "GHSA-3wwj-8j6r-q339", "until": "2027-03-01", + "reason": "Same tar 7 copies as GHSA-25mm-r35j-6hgm: under sqlite3 6.0.1, node-gyp 12 and @mapbox/node-pre-gyp 2.0.3, used only while installing, and removed from the Docker image. FHIRsmith's own tar is 8" + }, + { "id": "GHSA-98v3-7xjr-fg83", "until": "2027-03-01", + "reason": "Same tar 7 copies as GHSA-25mm-r35j-6hgm: under sqlite3 6.0.1, node-gyp 12 and @mapbox/node-pre-gyp 2.0.3, used only while installing, and removed from the Docker image. FHIRsmith's own tar is 8" + }, + { "id": "GHSA-wpwg-r92p-fjjh", "until": "2027-03-01", + "reason": "Same tar 7 copies as GHSA-25mm-r35j-6hgm: under sqlite3 6.0.1, node-gyp 12 and @mapbox/node-pre-gyp 2.0.3, used only while installing, and removed from the Docker image. FHIRsmith's own tar is 8" + }, + { "id": "GHSA-rgjp-p5j7-w36x", "until": "2027-03-01", + "reason": "Same tar 7 copies as GHSA-25mm-r35j-6hgm: under sqlite3 6.0.1, node-gyp 12 and @mapbox/node-pre-gyp 2.0.3, used only while installing, and removed from the Docker image. FHIRsmith's own tar is 8" + }, + { "id": "GHSA-qv2w-fc3h-pm27", "until": "2027-03-01", + "reason": "Same tar 7 copies as GHSA-25mm-r35j-6hgm: under sqlite3 6.0.1, node-gyp 12 and @mapbox/node-pre-gyp 2.0.3, used only while installing, and removed from the Docker image. FHIRsmith's own tar is 8" + }, + { "id": "GHSA-mpg7-vg3p-wc3m", "until": "2027-03-01", + "reason": "Same tar 7 copies as GHSA-25mm-r35j-6hgm: under sqlite3 6.0.1, node-gyp 12 and @mapbox/node-pre-gyp 2.0.3, used only while installing, and removed from the Docker image. FHIRsmith's own tar is 8" + }, + { "id": "GHSA-ffhw-4r4q-5cwv", "until": "2027-03-01", + "reason": "Same tar 7 copies as GHSA-25mm-r35j-6hgm: under sqlite3 6.0.1, node-gyp 12 and @mapbox/node-pre-gyp 2.0.3, used only while installing, and removed from the Docker image. FHIRsmith's own tar is 8" + }, + { "id": "GHSA-7c32-79xj-j3jp", "until": "2027-03-01", + "reason": "Same tar 7 copies as GHSA-25mm-r35j-6hgm: under sqlite3 6.0.1, node-gyp 12 and @mapbox/node-pre-gyp 2.0.3, used only while installing, and removed from the Docker image. FHIRsmith's own tar is 8" + }, + { "id": "GHSA-72fp-85cc-g945", "until": "2027-03-01", + "reason": "Same tar 7 copies as GHSA-25mm-r35j-6hgm: under sqlite3 6.0.1, node-gyp 12 and @mapbox/node-pre-gyp 2.0.3, used only while installing, and removed from the Docker image. FHIRsmith's own tar is 8" + }, + { "id": "GHSA-xm6h-2993-3ch9", "until": "2027-03-01", + "reason": "Same tar 7 copies as GHSA-25mm-r35j-6hgm: under sqlite3 6.0.1, node-gyp 12 and @mapbox/node-pre-gyp 2.0.3, used only while installing, and removed from the Docker image. FHIRsmith's own tar is 8" + }, + { "id": "GHSA-9hmx-4f52-v64x", "until": "2027-03-01", + "reason": "Same tar 7 copies as GHSA-25mm-r35j-6hgm: under sqlite3 6.0.1, node-gyp 12 and @mapbox/node-pre-gyp 2.0.3, used only while installing, and removed from the Docker image. FHIRsmith's own tar is 8" + }, + { "id": "GHSA-p96f-8xj2-g85p", "until": "2027-03-01", + "reason": "Same tar 7 copies as GHSA-25mm-r35j-6hgm: under sqlite3 6.0.1, node-gyp 12 and @mapbox/node-pre-gyp 2.0.3, used only while installing, and removed from the Docker image. FHIRsmith's own tar is 8" }] } From af1ebda9a7a3b6707dd2f52dcf15fa4a51f6d3c5 Mon Sep 17 00:00:00 2001 From: Italo Macedo Date: Thu, 3 Dec 2026 10:57:52 -0300 Subject: [PATCH 2/2] test: expect the parser to refuse the new htmlChecks cases that use .div 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 --- tests/library/fhir/fhirpath-check.test.js | 9 ++++++++- tests/library/fhir/fhirpath-parser.test.js | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/library/fhir/fhirpath-check.test.js b/tests/library/fhir/fhirpath-check.test.js index e5d19f76..8f60ee79 100644 --- a/tests/library/fhir/fhirpath-check.test.js +++ b/tests/library/fhir/fhirpath-check.test.js @@ -90,7 +90,14 @@ function checkTest(engine, t) { } // where library/fhir/fhirpath/parser.js is stricter than Java's (as fhirpath-parser.test.js) -const PARSER_STRICTER = new Set(['text.div.htmlChecks()', '@T14:34:28Z.is(Time)', '@T14:34:28+10:00.is(Time)']); +const PARSER_STRICTER = new Set([ + 'text.div.htmlChecks()', + '@T14:34:28Z.is(Time)', + '@T14:34:28+10:00.is(Time)', + "Bundle.entry.resource.where(id='p-inline').text.div.htmlChecks()", + "Bundle.entry.resource.where(id='p-nested-p').text.div.htmlChecks()", + "Bundle.entry.resource.where(id='p-table').text.div.htmlChecks()" +]); describe('the fhir-test-cases FHIRPath suite (r5/fhirpath/tests-fhir-r5.xml)', () => { const suite = readSuite(); diff --git a/tests/library/fhir/fhirpath-parser.test.js b/tests/library/fhir/fhirpath-parser.test.js index b8de755e..f47c9e3e 100644 --- a/tests/library/fhir/fhirpath-parser.test.js +++ b/tests/library/fhir/fhirpath-parser.test.js @@ -305,7 +305,14 @@ describe('real expressions', () => { test('the test suite\'s expressions parse, except the ones that are meant not to', () => { // fhirpath.js's grammar is stricter than Java's parser about these: div is a keyword // (text.`div` is right), and times have no time zone - const STRICTER = new Set(['text.div.htmlChecks()', '@T14:34:28Z.is(Time)', '@T14:34:28+10:00.is(Time)']); + const STRICTER = new Set([ + 'text.div.htmlChecks()', + '@T14:34:28Z.is(Time)', + '@T14:34:28+10:00.is(Time)', + "Bundle.entry.resource.where(id='p-inline').text.div.htmlChecks()", + "Bundle.entry.resource.where(id='p-nested-p').text.div.htmlChecks()", + "Bundle.entry.resource.where(id='p-table').text.div.htmlChecks()" + ]); const failed = []; for (const { text, invalid } of fromSuite) { let n = null;