NestJS v11.2.11: Watch Out for *path in Fastify Middleware, Plus Two FixesBrief · digest for November 19
Brief≈ 1 min

NestJS v11.2.11: Watch Out for *path in Fastify Middleware, Plus Two Fixes

Teams usually install x.y.Z patches without blinking, yet with NestJS v11.2.11 you should check your route masks first—especially on Fastify.

@nestjs/platform-fastify bumps @fastify/middie (the bridge for Express-style middleware in Fastify) from 9.3.4 to 9.3.6 (PR #18219). The update patches GHSA-5p92-8765-9fv8 (CVSS 9.1), where a double slash like /api//secret could silently bypass auth checks and rate limits.

Here's the catch: after the update, the *path wildcard no longer matches the root /. To keep middleware running on the homepage too, wrap the wildcard in curly braces as shown in the NestJS middleware docs:

// Fastify in NestJS v11.2.11+:
// '*path' no longer matches root '/'
// '{*path}' makes the trailing path optional
consumer
  .apply(LoggerMiddleware)
  .forRoutes({ path: '{*path}', method: RequestMethod.ALL });

Curly braces make the trailing segment optional so the handler catches both / and nested routes again. Grep your codebase for forRoutes( before deploying—otherwise logging or auth on / can vanish without throwing an error.

Version 11 also backports two fixes: DefaultValuePipe no longer collapses sparse arrays with empty slots like new Array(7) to [], and .clear in repl() stops wiping out NestJS helpers (get, debug, help) when resetting the context.

Want a deep diveVotes help us choose what to break down in detail. This material has 0 votes.
Sources · 4