Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

build(docker): install npm 12.2.1 and drop the Trivy ignores

Yudhi Armyndharisf16c6930b248
diff --git a/.github/workflows/js-sdk-release.yml b/.github/workflows/js-sdk-release.yml
index 2c5ef3086..448e549e9 100644
--- a/.github/workflows/js-sdk-release.yml
+++ b/.github/workflows/js-sdk-release.yml
@@ -125,7 +125,7 @@ jobs:
# the Dockerfile uses: this npm runs while the job can mint a publish credential, so it must
# not float to whatever version is current when the tag is pushed.
run: |
- npm install -g [email protected]
+ npm install -g [email protected]
npm --version
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
diff --git a/.trivyignore b/.trivyignore
index 77c229c67..ccd0c84b1 100644
--- a/.trivyignore
+++ b/.trivyignore
@@ -2,35 +2,9 @@
# Everything else — anything in the application's own dependency tree, and every OS package —
# still blocks promotion (see the image-scan job in .github/workflows/release.yml).
-# CVE-2026-102276 and CVE-2026-102278 (GHSA-6j4f-fj2g-mc7p, GHSA-qhr7-859c-m2p7): brace-expansion
-# denial of service through uncontrolled recursion, fixed upstream in 5.0.10 and 5.0.11.
-#
-# The only copy left in the image is the one bundled inside the npm CLI
-# (/usr/local/lib/node_modules/npm/node_modules/brace-expansion, 5.0.9 in npm 12.1.0, the newest
-# release and the one the Dockerfile installs). npm is never on the request path: the entrypoint
-# runs `node dist/main`, and npm is present only for the documented operator runbooks
-# (`docker compose run --rm openwa-api npm run migration:run:prod`). Reaching this code requires an
-# operator to run an npm command with an attacker-chosen glob inside the container.
-#
-# These are ID-level ignores, so they would also silence the same CVEs in the application tree,
-# which this file otherwise refuses to do. What keeps that honest is the root `overrides` entries
-# that pin brace-expansion per minimatch major (^1.1.21 under minimatch 3, ^2.1.7 under minimatch 5
-# and 9, ^5.0.12 under minimatch 10): npm cannot resolve the application tree below the fixed
-# versions, so there is no app-tree finding for these ids to hide. Raise those floors alongside any
-# future brace-expansion advisory rather than widening this list. Drop both entries once npm ships a
-# bundle with brace-expansion >= 5.0.11.
-CVE-2026-102276
-CVE-2026-102278
-
-# CVE-2026-19534 (GHSA-rfgv-xxqx-mfg5): undici denial of service, fixed upstream in 6.28.1, 7.29.1
-# and 8.10.2.
-#
-# Same shape as the entries above: the only affected copy is the one bundled inside the npm CLI
-# (/usr/local/lib/node_modules/npm/node_modules/undici, 6.28.0 in npm 12.1.0). The application tree
-# is at the fix on its own: undici is a direct dependency whose range starts at or above the fixed
-# 8.10.2, so this ID-level ignore cannot hide an application-tree finding. Drop this
-# entry once npm ships a bundle with undici >= 6.28.1.
-CVE-2026-19534
+# No ID is accepted at the moment. One goes here, above these notes, only with its reason and the
+# condition for removing it. The file stays even when empty because both scan workflows pass it to
+# the scan.
# Chromium: no entry, and the two architectures are not scanned alike.
#
diff --git a/Dockerfile b/Dockerfile
index 9e8fc293f..4c3e86804 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -233,7 +233,7 @@ RUN npm ci --omit=dev --ignore-scripts \
# Deliberately AFTER `npm ci`, so the application tree is still resolved by the npm the lockfile
# was generated with and only the global CLI is swapped. Pinned to the exact patch release —
# a floating npm@12 would make the image's bundled npm tree depend on when the build happened.
-RUN npm install -g [email protected] && npm cache clean --force
+RUN npm install -g [email protected] && npm cache clean --force
# amd64: download Chrome for Testing via Puppeteer and symlink it.
# arm64: use Debian's chromium installed above (a choice; see the note at that install).
diff --git a/src/common/ci-privilege-gate.spec.ts b/src/common/ci-privilege-gate.spec.ts
index c5ca6e1c4..926847e04 100644
--- a/src/common/ci-privilege-gate.spec.ts
+++ b/src/common/ci-privilege-gate.spec.ts
@@ -873,7 +873,12 @@ describe('a job that can mint a publish credential pins global npm installs and
oidcJobRuns('js-sdk-release.yml', executableLinesConservative).some(({ run }) => /^npm publish\b/m.test(run)),
).toBe(true);
expect(outsideAllowList('js-sdk-release.yml')).toEqual([]);
- expect(globalInstallsInOidcJobs('js-sdk-release.yml')).toEqual([{ job: 'publish', spec: '[email protected]' }]);
+ // The workflow says it installs the npm the image does; nothing else holds the two pins together.
+ const imageNpm = /^RUN npm install -g (npm@\d+\.\d+\.\d+) /m.exec(
+ fs.readFileSync(path.join(__dirname, '..', '..', 'Dockerfile'), 'utf8'),
+ )?.[1];
+ expect(imageNpm).toBeDefined();
+ expect(globalInstallsInOidcJobs('js-sdk-release.yml')).toEqual([{ job: 'publish', spec: imageNpm }]);
});
// Every workflow is read against its own list, so an id-token job anywhere that has none (a new