Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(docker,ci): ship a patched npm in the release image and scan against an explicit ignore list

Yudhi Armyndharis1b2a3131ab15
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index f1813f1fd..798944b0b 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -427,6 +427,11 @@ jobs:
matrix:
platform: [linux/amd64, linux/arm64]
steps:
+ # Needed for .trivyignore: the scan reads the image from the registry, but the ignore file
+ # is repo state and trivy-action resolves it from the workspace — without a checkout the
+ # file simply is not there and every entry is silently inert.
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+
- name: Login to GitHub Container Registry
uses: docker/login-action@abd2ef45e78c5afb21d64d4ca52ee8550d9572c7 # v4
with:
@@ -455,6 +460,9 @@ jobs:
severity: CRITICAL,HIGH
ignore-unfixed: true
exit-code: '1'
+ # Explicit rather than implicit: each entry in .trivyignore carries a written
+ # justification and a condition for removing it.
+ trivyignores: .trivyignore
# Applies the release tags (X.Y.Z — plus X.Y and latest for non-prereleases) to the image
# boot-smoke just proved can start, on BOTH registries (GHCR + Docker Hub — the tag set computed
diff --git a/.trivyignore b/.trivyignore
new file mode 100644
index 000000000..41e84bbbb
--- /dev/null
+++ b/.trivyignore
@@ -0,0 +1,17 @@
+# Vulnerabilities accepted for the release image scan, with an expiry review note each.
+# 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-14257 — brace-expansion ReDoS, fixed upstream in 5.0.8.
+#
+# The only copy in the image is the one bundled inside the npm CLI
+# (/usr/local/lib/node_modules/npm/node_modules/brace-expansion). The application tree resolves
+# 5.0.8 via the root `overrides` block, and npm itself is never on the request path: the
+# entrypoint runs `node dist/main`, and npm is present only for the documented operator runbooks
+# (`docker exec openwa npm run cli …`). Reaching this code requires an operator to run an npm
+# command with an attacker-chosen glob inside the container.
+#
+# npm 12 — the newest release, already installed by the Dockerfile — still bundles 5.0.7, so
+# there is currently no npm version that clears this finding. Drop this entry once npm ships a
+# bundle with brace-expansion >= 5.0.8.
+CVE-2026-14257
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2887bb99f..0c1001c8b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -379,7 +379,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
image on both `linux/amd64` and `linux/arm64`, and blocks the `promote` step (which applies the
`X.Y.Z`/`X.Y`/`latest` tags) on any fixable HIGH/CRITICAL. This covers the Debian packages baked
into `node:22-slim` — and the arm64-only `chromium` packages — that the source-tree `npm audit`
- gate cannot see. Runs at release time only, so it never touches fork-PR token permissions.
+ gate cannot see, plus the dependency tree bundled inside the image's own npm CLI: the production
+ image now installs npm 12 over the 10.9.8 the base image ships, clearing a critical `node-tar`
+ advisory along with `sigstore` and `picomatch` ones. A single accepted finding is carried in
+ `.trivyignore` with its justification and the condition for removing it; everything else still
+ blocks promotion. Runs at release time only, so it never touches fork-PR token permissions.
- **Session-scoped API keys can no longer escape their fence through key management or integration instance
management, and plugin `conversation.send` now verifies the mapping belongs to the envelope's session.**
diff --git a/Dockerfile b/Dockerfile
index fa6485e26..443f860ed 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -117,6 +117,15 @@ COPY scripts/postinstall.js scripts/patch-wwebjs-201832.js scripts/wwebjs-201832
# Install production dependencies only, then apply the backport patcher (needs `patch`).
RUN npm ci --omit=dev && node scripts/patch-wwebjs-201832.js && npm cache clean --force
+# Replace the npm the base image bundles. npm is not on the request path — the entrypoint runs
+# `node dist/main` — but it stays in the image because the operator runbooks drive it
+# (`docker exec openwa npm run cli …`, `npm run export`), and its own bundled dependency tree is
+# what the release image scan reports. node:22-slim currently ships npm 10.9.8, whose bundle
+# carries a critical node-tar advisory plus sigstore/picomatch ones; npm 12 fixes all three.
+# 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.
+RUN npm install -g npm@12 && npm cache clean --force
+
# amd64: download Chrome for Testing via Puppeteer and symlink it.
# arm64: use Debian's chromium installed above (CfT has no linux-arm64 build).
# test -n guards against a future path mismatch failing loudly instead of shipping a broken image.