[SECURITY] consumer-prices-core: upgrade fastify v4 → v5 to clear remaining HTTP-layer advisories
Context
A fresh snyk test / npm audit --omit=dev on consumer-prices-core (the Fastify + Playwright scraper on Railway) shows the HTTP framework layer is the main remaining source of advisories. [email protected] is in the live request path (src/api/server.ts — Fastify({...}) + server.listen(...)), so these are genuinely reachable for anyone who can hit the service.
fastify advisories (need a major v4 → v5 bump)
| GHSA / CVE | Title | Severity | Baselined? |
|---|---|---|---|
GHSA-jx2c-rxcm-jvmq / CVE-2026-25223 |
Content-Type tab char allows body interpretation conflict | High | yes |
CVE-2026-33806 |
Improper validation of specified input type | High | — |
GHSA-444r-cwp2-x5xf |
request.protocol / request.host spoofable |
Moderate | — |
GHSA-mrq3-vjjr-p77c |
DoS via unbounded memory allocation | Low | — |
All are fixed only in the [email protected] line — i.e. a breaking major upgrade, not a patch bump, which is why this is a tracked task rather than a drive-by PR.
Already handled / cheap siblings (not this issue)
fast-uriadvisoriesGHSA-q3j6-qgpj-74h6(path traversal) +GHSA-v39h-62p7-jpjc(host confusion) → already addressed in #4355 (fast-uri → 3.1.1).js-yamlGHSA-h67p-54hq-rp68(quadratic-complexity DoS, moderate) → trivial bump4.1.1 → 4.2.0; could be folded into the v5 PR or shipped on its own.
Scope of work
- Bump
fastify4 → 5 and the@fastify/*plugins to their v5-compatible majors (@fastify/cors,@fastify/ajv-compiler, etc.). - Apply the v5 migration deltas (v5 changes default body-parser behavior,
request.routerPath, logger config, and a few hook signatures). The surface here is small — a handful of GET/POST routes (/overview,/movers,/retailer-spread,/freshness,/categories,/basket-series). - After the bump, remove the now-resolved
GHSA-jx2c-rxcm-jvmqfrom theconsumer-prices-corebaseline inaudit-production-dependencies.mjs(and re-point any test fixtures that key off it).
Related hardening (worth doing alongside)
The request auth hook is fail-open:
const API_KEY = process.env.WORLDMONITOR_SNAPSHOT_API_KEY;
server.addHook('onRequest', async (request, reply) => {
if (API_KEY) { /* check x-api-key */ }
// if API_KEY is unset → no auth at all
});
If WORLDMONITOR_SNAPSHOT_API_KEY is ever unset in an environment, every endpoint is unauthenticated. Worth either asserting the key is present at boot (fail-closed) or confirming it's always provisioned in prod — this directly affects how exposed the fastify CVEs above are.
Why tracked, not patched now
Per SECURITY.md (only "dependency vulnerabilities with a viable attack vector" are in scope), these are reachable but mitigated by the service being a standalone Railway worker behind an (optional) API key. The fix is a breaking framework upgrade that deserves its own tested PR rather than being rushed.
Surfaced by a full Snyk sweep of the repo; siblings tracked in #4355 (fast-uri), #4365 (base-image GnuTLS), #4364 (zlib no-fix).