Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
54 changes: 54 additions & 0 deletions audit-allowlist.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}]
}
9 changes: 8 additions & 1 deletion tests/library/fhir/fhirpath-check.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
9 changes: 8 additions & 1 deletion tests/library/fhir/fhirpath-parser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading