Repository navigation
fix(deps): upgrade express to v5 and http-proxy-middleware to v3 - #7927
Merged
Merged
Conversation
serhalp
force-pushed
the
fix/upgrade-express
branch
from
February 4, 2026 11:37
d9576cb to
e4fe843
Compare
`express > qs` and `express > body-parser > qs` have `high` security vulnerabilities that cannot be addressed without upgrading from v4 to v5, as the fixes have not been backported: GHSA-6rw7-vpxm-498p. - Upgrade express from v4 to v5: https://github.com/expressjs/express/blob/master/History.md#500--2024-09-10 - Upgrade http-proxy-middleware from v2 to v3 (required due to express upgrade): https://github.com/chimurai/http-proxy-middleware/blob/master/MIGRATION.md Note: ideally we wouldn't be using express at all, as it is overkill for our use cases. At the very least, since we're already using fastify, we should use that. Otherwise, we could be using something like https://npmx.dev/package/@tinyhttp/app. But all this is even more moot, because all the code that uses express, fastify, and http-proxy-middleware has already been extracted into [`@netlify/dev`](https://github.com/netlify/primitives/tree/main/packages/dev), where it has been refactored to not use any of these. But pulling that back in is a significant refactor. We'll get to it eventually.
serhalp
force-pushed
the
fix/upgrade-express
branch
from
February 4, 2026 13:30
e4fe843 to
43ae859
Compare
serhalp
commented
Feb 4, 2026
| await withDevServer({ cwd: builder.directory }, async (server) => { | ||
| const getResponse = await fetch(`${server.url}/api/ping`) | ||
| const jsonPingWithGet = await getResponse.json() | ||
| t.expect(jsonPingWithGet).toHaveProperty('body', {}) |
Member
Author
There was a problem hiding this comment.
req.body defaults to undefined instead of {} when no body parser matches now. I deleted the assertions instead of updating them because there's nothing valuable to test here — GETs don't have request bodies.
(If you're confused that this appears to be a response body, it's because the test is setting up a Function that echoes back some request fields.)
serhalp
marked this pull request as ready for review
February 4, 2026 13:49
eduardoboucas
approved these changes
Feb 4, 2026
Member
Author
|
I did some local testing of functions emulation for good measure ✅. |
8 tasks done
lucasbraum
added a commit
to uptide-dev/uptide
that referenced
this pull request
Oct 15, 2026
…PT-55) Fixed before the first score: netlify/cli#7927, bcgov/tenant-management-system#699, amiantos/lurker#147, openhab/openhab-cloud#550. Drafted with packs:truth and reviewed by hand. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lucas Braum <[email protected]>
lucasbraum
added a commit
to uptide-dev/uptide
that referenced
this pull request
Oct 15, 2026
## Pack `express` `>=4 <5` → `>=5 <6` (default target 5.3.0). Linear: UPT-55. **Candidate by choice.** The branch is rebased on UPT-48 (#155) and UPT-63 (#157). `pack test` passes and measures verified. The record stays `candidate` until a person has reviewed it. ## Sources All pinned and read 2026-10-14 (ledger in `packages/core/src/packs/express/RESEARCH.md`): - Migration guide, expressjs.com `4721193` - History.md at v5.3.0 (`cf6722b`) - path-to-regexp Readme at v8.4.2 - body-parser HISTORY at 2.3.0 - @types/express 4.17.25 / 5.0.6 and @types/express-serve-static-core 4.19.9 / 5.1.3 declarations - expressjs/codemod at `2f7f1e5`. These were read, never run. `@expressjs/codemod` 0.0.5 is deprecated on npm. ## Rules and behavior notes No rule rewrites. Every codemod rewrite is either unsafe whatever the surrounding code, or never met a real site: - `del` and `send` don't check the receiver. - `param` drops values that came from the body or query. - `dotfiles: 'allow'` serves dotfiles Express 4 hid. - Route paths are the owner's choice, and handlers' `req.params[0]` changes with them. Rules: - `route-syntax` (detect): path-to-regexp 8 route strings on an app or router the file binds. Covers `express()`, `Router()`, typed parameters and properties, `this.app`, a `const` list, and `for…of` over one. One site per registration. - `params-string-array` (compiler message): `req.params` values are `string | string[]`. The guide types the params and never casts. - `req-param-removed`, `sendfile-renamed`, `static-mime-removed`, `query-middleware-removed`: compiler messages. - `redirect-order`, `param-callback-removed`: detected, because their compiler messages are too generic to claim. Behavior notes: - Findings: `redirect-back` and `send-status-number`, detected on Express responses. - Decisions: `async-errors`, `req-body-undefined` (also a test follow-up), `query-parser`, `urlencoded-extended`, `static-dotfiles`, `node-minimum` (only when `engines.node` allows below 18), and `runtime-defaults`. Engine change: with the pack in use, `check` skips its curated, text-matched express 5 runtime findings for the package, because the pack owns those sites. The generic tier is unchanged. ## Ground-truth repositories The ground truth was committed in `ab94e71` before the first score and has not been changed since. 88 sites, 86 of them breaking. - [netlify/cli#7927](netlify/cli#7927): pinned `63b6f1cb`, 10 sites (8 routes, 2 `req.body` test assertions). - [bcgov/tenant-management-system#699](bcgov/tenant-management-system#699) (`backend/`): pinned `6fd01755`, 54 sites. - [amiantos/lurker#147](amiantos/lurker#147): pinned `f7a0f3da`, 18 sites. - [openhab/openhab-cloud#550](openhab/openhab-cloud#550): pinned `5a1866ef`, 6 sites. Screened out: snapshot-labs/stamp#711 (engines `node >=24.15`, while CI runs Node 22) and others. The list is in RESEARCH.md. ## `uptide pack test` output Run once after the rebase, with per-pack caches. The ground truth is unchanged since `ab94e71`. ``` uptide pack test express · verified, recorded candidate fixtures 2 cases, 17 sites · pass ground truth netlify/cli@63b6f1cbca31 express 4.22.1 → 5.2.1 predicted 5, expected 10, false positives 0, false negatives 5 with @types/express 4.17.25 → 5.0.6 · verdaccio 6.2.4 keeps its own express 4.21.2; no release accepts express 5.2.1 · http-proxy-middleware: the upgrade moved it to 3.0.5, check leaves it (peer conflict: http-proxy-middleware 2.0.9 declares @types/express ^4.17.13) bcgov/tenant-management-system@6fd01755043a express 4.22.2 → 5.2.1 predicted 53, expected 54, false positives 0, false negatives 1 with @types/express 4.17.21 → 5.0.6 amiantos/lurker@f7a0f3dac775 express 4.22.2 → 5.2.1 predicted 10, expected 18, false positives 0, false negatives 8 with @types/express 4.17.25 → 5.0.6 openhab/openhab-cloud@5a1866efe1c0 express 4.22.1 → 5.2.1 predicted 5, expected 6, false positives 0, false negatives 1 with @types/express 4.17.25 → 5.0.6 · body-parser: the upgrade moved it to 2.2.2, the repository's choice (it does not depend on the package) · serve-static: the upgrade moved it to 2.2.1, the repository's choice (it does not depend on the package) rule precision recall tp fp fn generic 100% 50% 1 0 1 params-string-array 100% 87% 62 0 9 req-body-undefined n/a 0% 0 0 2 route-syntax 100% 77% 10 0 3 overall (sites) 100% 83% 73 0 15 behavior notes (sites) n/a 0% 0 0 2 breaking (sites) 100% 85% 73 0 13 gate 86 breaking sites, 2 behavior-note sites in public ground truth · verified recorded candidate by choice; measures verified PASS express: verified ``` The moves are now explained rather than failing: - verdaccio keeps a nested copy of express 4. - http-proxy-middleware is a peer conflict, which `check` names and leaves in place. - body-parser and serve-static are the repository's own choice. ## Checklist - [x] Every rule and note comes from a source listed in `meta.sources` - [x] Every rule that rewrites or detects has a fixture case, with a site it must leave alone (`keep`) - [x] Ground truth: public repositories at the commit before their upgrade; expected findings read from their own upgrade commit and the compiler, never copied from Uptide's output - [x] At least two public repositories for `verified`; otherwise the pack ships as a candidate - [x] `pnpm uptide pack test express` passes and measures verified. `verification.json` was written with `--write`, then set to candidate by choice. - [x] `pnpm lint` and `pnpm typecheck` pass. `pnpm test` passes. - [x] Changeset added - [x] No private code, names or paths anywhere: fixtures are synthetic, ground truth is public 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Lucas Braum <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
express > qsandexpress > body-parser > qshavehighsecurity vulnerabilities that cannot be addressed without upgrading from v4 to v5, as the fixes have not been backported: GHSA-6rw7-vpxm-498p.This PR upgrades to v5, which resolves all remaining security vulnerabilities:
As a bonus, this removes 20 transitive deps and ~1 MB from the install size.
Upgrade express from v4 to v5
Release notes: https://github.com/expressjs/express/blob/master/History.md#500--2024-09-10
Upgrade http-proxy-middleware from v2 to v3
This is required due to the express upgrade.
Release notes: https://github.com/chimurai/http-proxy-middleware/blob/master/MIGRATION.md
Notes
Note: ideally we wouldn't be using express at all, as it is overkill for our use cases. At the very least, since we're already using fastify, we should use that. Otherwise, we could be using something like https://npmx.dev/package/@tinyhttp/app. But all this is even more moot, because all the code that uses express, fastify, and http-proxy-middleware has already been extracted into
@netlify/dev, where it has been refactored to not use any of these. But pulling that back in is a significant refactor. We'll get to it eventually.