Commit Graph
22434 Commits
Author SHA1 Message Date
Kamil Myśliwiec f159ac6f46 fix(node): trust no proxy for a hop count, as fastify does
A hop count cannot tell the socket's peer from a client that sends its
own X-Forwarded-For, so Fastify 5.12.1 and later trust no proxy for one,
and leave numbers out of the type of its trustProxy option. The Node
adapter now does the same, instead of trusting that many hops as Express
does. Addresses, subnets, true and functions are unchanged.
2026-10-27 09:50:42 +01:00
Kamil Myśliwiec d72b82e03f feat(node): add an option to parse the query string
The Node adapter parses query strings with fast-querystring into flat
keys, as Express and Fastify do by default, but offered no way to parse
nested objects and arrays, which Express gets from its "query parser"
setting and Fastify from its querystringParser option. As with Fastify,
new NodeAdapter({ querystringParser }) takes a function the query string
is passed to (without the "?", and "" when the URL has none), such as
str => qs.parse(str). Without it, requests run the same code as before.
2026-10-27 09:36:19 +01:00
Kamil Myśliwiec f9fd281a40 feat(node): add an option to trust proxies
Behind a reverse proxy, req.ip was always the proxy's address and
req.protocol "http" behind one that terminates TLS, so the throttler
counted every client as one, express-session would not set secure
cookies, and passport built http:// callback URLs. As Express' "trust
proxy" setting and Fastify's option of the same name, new NodeAdapter({
trustProxy }) takes true, a hop count, addresses or subnets, or a
function. For a request from a trusted proxy, req.ip, req.ips,
req.protocol, req.secure and req.hostname are read from the
X-Forwarded-* headers the way Express reads them, and
req.app.get('trust proxy') returns the setting. Unlike Fastify, which no
longer trusts a hop count, the adapter trusts it as Express does.

Without the option, the requests are NodeRequests as before: the getters
that read the headers belong to a subclass the option creates, so the
default requests run the same code. req.ips is new (empty there), and
req.protocol is typed as a string, as with Express.
2026-10-27 09:34:51 +01:00
Kamil Myśliwiec 3dbd0f8f2e test(node): run master's new spec cases on the node adapter
The Node twins of the disconnect specs now wait for the producer teardown
as the Express and Fastify ones do since #18260, which fixes the same
off-by-one tick under load. getUrl() is checked for an https server
(#18252), and the specs of #18276 for middleware on routes that differ
only in their version run on the Node adapter too; both pass as they are.
2026-10-27 09:27:43 +01:00
Kamil Myśliwiec 092b088098 fix(node): update multer to 2.5.0 and find-my-way to 9.10.0
As platform-express (#18268) and platform-fastify pin them. multer 2.5.0
fixes GHSA-q7qp-rjg7-q26m: a request aborted while an asynchronous
fileFilter is pending could crash the process.
2026-10-27 09:26:34 +01:00
Kamil Myśliwiec ae02dca46a fix(node): copy the multer fixes of platform-express again
The multer interceptors are copies of platform-express' (the file upload
parity spec checks it). Two fixes landed there since: a multipart request
with an unsupported content type is answered with a 415 (#18264), and
isRejectedByPipes() is no longer a named import from @nestjs/core/internal,
which made the package fail to load with a core older than 12.2 (#18251).
2026-10-27 09:26:31 +01:00
Kamil Myśliwiec 5d6ca1b91f Merge remote-tracking branch 'origin/master' into feat/platform-node 2026-10-27 09:25:09 +01:00
Kamil Myśliwiec dc9b319dc8 test(node): cover trailing bytes after a compressed body
Ports body-parser's tests for bytes that arrive after a compressed frame,
which zlib ends the decompression stream on since Node.js 11: the request
still finishes, a late decoder error is swallowed instead of ending the
process, and a body rejected for its charset never creates a decoder. The
parser already keeps an error listener on the decoder once it has read the
body; without it, these tests report the decoder's error as uncaught.
2026-10-27 09:11:10 +01:00
Kamil Myśliwiec 10adb73c57 fix(core): check the sse pending data limit after each write
An SSE client whose stream is backed up is dropped once more event data
waits for it than the route's "maxPendingDataLength" allows. The limit
was only checked when the producer emitted an event. A producer that
emits many events at once, synchronously (e.g. replaying past events
before live ones), emits them all before the first write can back the
stream up, and none after, so they waited in memory for a client that
never read them, past the limit.

The limit is now also checked after each write, once the stream is
backed up. A route that sends more than its limit at once, to a client
that reads slower than the events are written, now drops that client
as well, as the limit describes. Such a route can raise or lift it.
2026-10-27 08:48:03 +01:00
Denis Scarabelli f991703156 fix(common): report the detected file type in file type errors (#18289) 2026-10-27 08:44:07 +01:00
renovate[bot] 870c54b44d fix(deps): update graphql-tools monorepo (major) (#18283) 2026-10-26 22:41:51 +01:00
Kamil Mysliwiec b7a891ee73 chore(deps): update undici to v8.12.3 and fast-uri to v3.1.9 (#18286) 2026-10-26 22:28:53 +01:00
renovate[bot] 66652ab239 fix(deps): update graphql-tools monorepo (#18281) 2026-10-26 22:28:41 +01:00
renovate[bot] f7fff4848f fix(deps): update dependency @nestjs/webhooks to v0.0.3 (#18258) 2026-10-26 22:27:58 +01:00
renovate[bot] 6d54083eeb fix(deps): update dependency dotenv to v18.0.9 (#18259) 2026-10-26 22:27:14 +01:00
renovate[bot] 2c12e2b7d7 fix(deps): update dependency mercurius to v16.12.1 (#18280) 2026-10-26 22:26:31 +01:00
renovate[bot] c0284c3c21 fix(deps): update dependency fast-json-stringify to v7.2.0 (#18274) 2026-10-26 22:16:40 +01:00
Om Bhandwaldar f640806541 fix(core): run middleware once for routes that differ only in version (#18276) 2026-10-26 22:14:31 +01:00
Kamil Mysliwiec 6aafca1fd8 fix(ws,microservices): load packages where bundlers can see them (#18285)
* fix(ws): import ws statically so bundlers include it

ws is a dependency of @nestjs/platform-ws, but the adapter loaded it
with createRequire(import.meta.url)('ws') in its constructor, which
esbuild and rolldown don't follow: a bundled app left ws out and exited
with "ws package is missing". A static import is bundled by all of them.

* fix(microservices): load transport packages where bundlers can see them

ClientMqtt, ClientRMQ, ClientNats, ServerGrpc and ServerRMQ loaded their
packages with createRequire() in the constructor, which esbuild and
rolldown don't follow. They now load them with a literal import() when
the client connects or the server listens, as ServerKafka and
ServerRedis already do. createClient() of ClientMqtt and ClientRMQ still
loads the package when called before connect().

ClientGrpcProxy keeps its synchronous load, since getService() is
synchronous; bundled applications have to mark its packages external.

* docs(common): note which bundlers resolve synchronous package loaders

webpack 5 follows createRequire(import.meta.url)('pkg'), esbuild and
rolldown don't. Point to a literal import() loader or a static import.
2026-10-26 15:11:18 +01:00
Kamil Myśliwiec d22065e0d5 fix(microservices): bound how long a tcp packet may take to arrive
A packet's declared length was never compared against "maxBufferSize",
so a packet that could never be accepted was still buffered until the
buffer filled up. It is now rejected as soon as its length is read, and
the connection is dropped, since everything that follows is the rest of
that packet.

The idle timer for a partially received packet is refreshed on every
read, so a peer that sends a few bytes now and then kept a partial
packet buffered for as long as it liked. The new "messageReceiveTimeout"
option (default: 300000ms, like "requestTimeout" in node:http) bounds
the time from a packet's first character to its last, and is not
extended by further reads. Time spent with reading suspended due to
backpressure is not counted. Set it to 0 to disable it.

Also corrects the comment on the default "maxBufferSize": it is counted
in characters, which take 1 or 2 bytes each, not 4.
2026-10-26 09:02:24 +01:00
renovate[bot] af957c9a67 chore(deps): update mysql docker tag to v26.10.0 (#18273) 2026-10-25 21:27:46 +01:00
renovate[bot] ef940a16f3 fix(deps): update dependency hbs to v4.4.0 (#18275) 2026-10-25 21:27:04 +01:00
renovate[bot] 27180cb194 chore(deps): update dependency webpack to v5.112.2 (#18271) 2026-10-25 21:26:21 +01:00
renovate[bot] 5caa6c7968 fix(deps): update dependency mongoose to v9.11.4 (#18270) 2026-10-25 21:16:40 +01:00
dependabot[bot] eb7fea2862 chore(deps): bump fast-uri in /tools/benchmarks (#18265) 2026-10-25 21:06:27 +01:00
dependabot[bot] f74297c850 chore(deps): bump body-parser from 2.3.0 to 2.4.0 in /tools/benchmarks (#18266) 2026-10-25 21:05:43 +01:00
renovate[bot] 5b91e5b8c9 chore(deps): update dependency body-parser to v2.4.0 [security] (#18267) 2026-10-25 21:05:01 +01:00
renovate[bot] 0eef54172d fix(deps): update dependency multer to v2.5.0 [security] (#18268) 2026-10-25 20:53:07 +01:00
Junpei Zhang 3eb55705a6 docs: fix subject-verb agreement in contributing guide (#18269) 2026-10-25 20:52:03 +01:00
Om Bhandwaldar 11e1466b96 perf(microservices): parse message patterns only when they may be json (#18277) 2026-10-25 20:51:57 +01:00
Maksym Lyskov ff84deb156 fix(common): keep one route param per argument in an overriding method (#18272) 2026-10-25 20:51:50 +01:00
snowingfox 3e2309e918 fix(core): tolerate sse request sockets without tuning methods (#18262) 2026-10-24 20:41:50 +02:00
yooseong 0c9db73505 fix(express): map unsupported multipart content types to 415 (#18264) 2026-10-24 20:41:42 +02:00
Kamil Mysliwiec 50abd26d5b test(core): wait for the producer teardown in the disconnect specs (#18260)
The disconnect specs read the tick count right after the client destroyed its socket, but the server only sees the disconnect once the socket close reaches it. Under load the producer's 20 ms interval could tick once more in between, so the count was off by one (7 of 12 runs failed under full CPU load).

The producer now records its teardown, and the specs take the count once it has happened. They still fail when the producer is never stopped.
2026-10-24 20:22:00 +02:00
renovate[bot] ac26786497 fix(deps): update nest monorepo (#18141) 2026-10-24 15:30:28 +02:00
renovate[bot] b5ea32b127 chore(deps): update dependency oxlint to v1.89.0 (#18205) 2026-10-24 15:13:08 +02:00
renovate[bot] bb54a295ea chore(deps): update dependency typescript-eslint to v8.72.0 (#18237) 2026-10-24 15:12:27 +02:00
renovate[bot] 0993247d97 chore(deps): update dependency @fastify/multipart to v10.1.6 (#18242) 2026-10-24 15:10:03 +02:00
renovate[bot] 3ec329f72b fix(deps): update dependency @nestjs/outbox to v0.1.3 (#18243) 2026-10-24 14:58:17 +02:00
renovate[bot] 772bd1c661 fix(deps): update dependency @nestjs/swagger to v12.0.4 (#18244) 2026-10-24 14:58:12 +02:00
Kamil Mysliwiec 28113250fa fix(deps): update dependency file-type to v22.2.0 (#18257) 2026-10-24 14:52:46 +02:00
Kamil Mysliwiec 0828b0d41c Merge pull request #18248 from thekhegay/node-router-fixes
fix(node): route matching fixes and middleware prefix skipping
2026-10-24 14:48:30 +02:00
Maksym Lyskov 41030750ef fix(fastify): send object error bodies with a json content type (#18253) 2026-10-24 14:35:53 +02:00
Roman Khegay 0fb57c8b07 fix(core,express,fastify,ws,socket.io): load adapters with an older core (#18251) 2026-10-24 14:35:13 +02:00
Roman Khegay 135f999b6d fix(core): read the url protocol from the server (#18252) 2026-10-24 14:22:58 +02:00
Roman Khegay 79b57f962c fix(core): name the array and index of undefined module entries (#18254) 2026-10-24 14:22:50 +02:00
Abdellatif Anaflous ddb753accd fix(microservices): re-arm the redis retries on a new listen (#18250) 2026-10-24 14:22:42 +02:00
Roman Khegay ce57692f1f fix(microservices): report a nats connection that gave up reconnecting (#18255) 2026-10-24 14:22:34 +02:00
Roman Khegay 2b6bacb71a fix(microservices): do not emit a trailing null to kafka requesters (#18249) 2026-10-24 14:22:26 +02:00
Abdellatif Anaflous e5b2436946 fix(microservices): let a retriable exception keep travelling (#18256) 2026-10-24 14:22:17 +02:00