Skip to content

chore(deps): update dependency @nestjs/platform-fastify to v11.2.4 [security] - #575

Open
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/npm-nestjs-platform-fastify-vulnerability
Open

renovate[bot] wants to merge 1 commit into
mainfrom
renovate/npm-nestjs-platform-fastify-vulnerability

Conversation

@renovate

@renovate renovate Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
@nestjs/platform-fastify (source) 11.1.17 → 11.2.4 age confidence

Nest: Middleware Bypass on Fastify via Trailing Slash

CVE-2026-54281 / GHSA-6v32-fjc9-9qf6

More information

Details

Impact

An authentication bypass vulnerability exists in @nestjs/platform-fastify (confirmed on version 11.1.24, the latest available release at time of report). When middleware is registered through NestJS's MiddlewareConsumer.forRoutes() API on the Fastify adapter, an unauthenticated client can bypass the Nest middleware registered for that route by simply appending a trailing slash (/) to the request URL.

This bypass works on the default Fastify adapter configuration — no special router options need to be enabled. Applications using the standard CRUD route shape (GET /resource and GET /resource/:id) are affected when they protect those routes with MiddlewareConsumer.forRoutes() middleware.

Patches

Fixed in @nestjs/platform-fastify@11.1.24

References

Kudos goes to @​a-tt-om

Severity

  • CVSS Score: 8.7 / 10 (High)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:L/SC:N/SI:N/SA:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


@​nestjs/platform-fastify: Path-scoped middleware bypass via absolute-form request targets

GHSA-9c5c-9qcx-q35q

More information

Details

Field Value
Ecosystem npm
Package @nestjs/platform-fastify
Affected versions >= 12.0.0, < 12.0.2 and < 11.2.4
Patched versions 12.0.2 and 11.2.4 (upgrade to 12.0.3 / 11.2.5)
Summary

On the Fastify adapter, an HTTP request that uses an absolute-form request target (GET http://host/path HTTP/1.1
instead of GET /path HTTP/1.1) reaches the route handler without running the path-scoped Nest middleware bound to
that route. Applications that enforce authentication or authorization in middleware execute the protected handler
with those checks skipped.

Impact

Any application that

  • uses @nestjs/platform-fastify, and
  • binds middleware to specific paths via MiddlewareConsumer.forRoutes(...) or .exclude(...), and
  • is reachable by a client that controls the raw request line.

Node's HTTP server accepts absolute-form targets, so no special server configuration is needed. Exposure is reduced
when a reverse proxy in front of the application rewrites the request target to origin-form, which most do.

Where the bypassed middleware performs authentication or authorization, the result is an authentication or
authorization bypass. Where it performs logging, rate limiting or body handling, those are silently skipped instead.

Details

Fastify's router (find-my-way) resolves an absolute-form target to its path before matching, so the route handler
is dispatched normally. Two places on the middleware side matched against the raw request target instead:

  1. The bundled copy of the @fastify/middie engine at packages/platform-fastify/adapters/middie/fastify-middie.ts.
    NestJS carried this fork to apply an earlier path-decoding fix and it did not track the upstream absolute-form fix
    released in @fastify/middie@9.3.4.
  2. FastifyAdapter's own re-check in createMiddlewareFactory(), which tests the middleware path regexp against
    req.originalUrl.

Both normalized and percent-decoded the target, but neither resolved absolute-form to a path, so the router and the
middleware layer disagreed about which path was being requested.

A second, related defect contributed. Because the adapter always passes routerOptions (to install the version
constraint), Fastify did not reflect the deprecated top-level router options (ignoreTrailingSlash,
ignoreDuplicateSlashes, caseSensitive, useSemicolonDelimiter) in initialConfig.routerOptions, which is what
the middleware engine reads. Applications passing those options at the top level had middleware normalize paths
differently from the router, which widened the mismatch.

Proof of concept
@Controller('users')
export class UsersController {
  @Get()
  findAll() {
    return 'protected data';
  }
}

@Module({ controllers: [UsersController] })
export class AppModule implements NestModule {
  configure(consumer: MiddlewareConsumer) {
    consumer
      .apply((req, res) => res.end('blocked by auth middleware'))
      .forRoutes({ path: 'users', method: RequestMethod.GET });
  }
}

supertest and light-my-request always emit origin-form targets, so the request has to be written to the socket:

const { connect } = require('node:net');

const socket = connect(3000, '127.0.0.1', () => {
  socket.write(
    'GET http://127.0.0.1:3000/users HTTP/1.1\r\n' +
      'Host: 127.0.0.1:3000\r\n' +
      'Connection: close\r\n\r\n',
  );
});
socket.pipe(process.stdout);

Observed on an affected version: protected data — the middleware did not run.
Expected, and observed on a patched version: blocked by auth middleware.

Patches

Fixed in 12.0.2 and 11.2.4. Upgrading to 12.0.3 or 11.2.5 is recommended.

  • The bundled @fastify/middie fork was removed and the package now depends on @fastify/middie@9.3.4, which
    resolves absolute-form targets before matching.
  • The adapter resolves absolute-form targets in its own route check, mirroring find-my-way.
  • Deprecated top-level Fastify router options are folded into routerOptions so the middleware engine and the
    router normalize paths identically.
Workarounds

If you cannot upgrade, reject non-origin-form request targets before middleware runs. Register the hook on the
Fastify instance before the application is initialized, so that it runs ahead of the middleware engine's own
onRequest hook, and confirm with the request above that the rejection takes effect:

const adapter = new FastifyAdapter();
adapter.getInstance().addHook('onRequest', (request, reply, done) => {
  const target = request.raw.url ?? '';
  // "*" is the legitimate request target of "OPTIONS * HTTP/1.1"
  if (target[0] !== '/' && target !== '*') {
    reply.code(400).send();
    return;
  }
  done();
});

Rejecting or normalizing absolute-form targets at a reverse proxy in front of the application is equally effective.

Credit

Reported by ZeroVuln Labs.

Severity

  • CVSS Score: 7.4 / 10 (High)
  • Vector String: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

nestjs/nest (@​nestjs/platform-fastify)

v11.2.4

Compare Source

What's changed
  • fix(microservices): handle unserializable patterns without crashing
  • fix(platform-fastify): absolute-form request target middleware bypass

v11.2.3

Compare Source

What's Changed

Full Changelog: nestjs/nest@v11.2.2...v11.2.3

v11.2.2

Compare Source

What's changed

v11.2.1

Compare Source

What's Changed

Full Changelog: nestjs/nest@v11.2.0...v11.2.1

v11.2.0

Compare Source

What's Changed
New Contributors

Full Changelog: nestjs/nest@v11.1.29...v11.2.0

v11.1.29

Compare Source

What's Changed
New Contributors

Full Changelog: nestjs/nest@v11.1.28...v11.1.29

v11.1.28

Compare Source

v11.1.28 (2026-07-08)
Bug fixes
  • core
    • #​17239 fix(core): trigger teardown of SSE producer Observable on client disconnect with interceptor (@​jyx-07)
  • common
  • websockets
Enhancements
Dependencies
Committers: 4

v11.1.27

Compare Source

What's Changed

Full Changelog: nestjs/nest@v11.1.26...v11.1.27

v11.1.26

Compare Source

What's Changed

Full Changelog: nestjs/nest@v11.1.25...v11.1.26

v11.1.25

Compare Source

What's Changed

New Contributors

Full Changelog: nestjs/nest@v11.1.24...v11.1.25

v11.1.24

Compare Source

v11.1.24 (2026-05-25)

Bug fixes
Enhancements
Dependencies
Committers: 2

v11.1.23

Compare Source

v11.1.23 (2026-05-21)

Bug fixes
  • core
    • #​16998 fix snapshot: true eagerly instantiates Terminus transient indicators since 11.1.20
Committers: 1

v11.1.22

Compare Source

v11.1.22 (2026-05-21)

Bug fixes
Enhancements
Committers: 2

v11.1.21

Compare Source

v11.1.21 (2026-05-14)

Bug fixes
Committers: 1

v11.1.20

Compare Source

v11.1.20 (2026-05-13)

Bug fixes
Enhancements
Dependencies
Committers: 13

v11.1.19

Compare Source

v11.1.19 (2026-04-13)
Bug fixes
Committers: 2

v11.1.18

Compare Source

v11.1.18 (2026-04-03)

Bug fixes
Dependencies
Committers: 6

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@changeset-bot

changeset-bot Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c2165d7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@renovate
renovate Bot force-pushed the renovate/npm-nestjs-platform-fastify-vulnerability branch 2 times, most recently from 55d74c8 to 0e775ad Compare August 14, 2026 20:52
@renovate
renovate Bot force-pushed the renovate/npm-nestjs-platform-fastify-vulnerability branch from 0e775ad to 5288b1e Compare August 26, 2026 13:03
@renovate
renovate Bot force-pushed the renovate/npm-nestjs-platform-fastify-vulnerability branch 3 times, most recently from a293e53 to 57b6d84 Compare September 7, 2026 15:56
@renovate
renovate Bot force-pushed the renovate/npm-nestjs-platform-fastify-vulnerability branch 3 times, most recently from 29ee7ea to 09f93d0 Compare September 15, 2026 17:48
@renovate
renovate Bot force-pushed the renovate/npm-nestjs-platform-fastify-vulnerability branch 2 times, most recently from dadcdec to 56a1189 Compare September 24, 2026 23:32
@renovate
renovate Bot force-pushed the renovate/npm-nestjs-platform-fastify-vulnerability branch from 56a1189 to 6bca5b2 Compare October 1, 2026 00:58
@renovate
renovate Bot force-pushed the renovate/npm-nestjs-platform-fastify-vulnerability branch from 6bca5b2 to 146e9f8 Compare October 10, 2026 21:58
@renovate renovate Bot changed the title chore(deps): update dependency @nestjs/platform-fastify to v11.1.24 [security] chore(deps): update dependency @nestjs/platform-fastify to v11.2.4 [security] Oct 10, 2026
@renovate
renovate Bot force-pushed the renovate/npm-nestjs-platform-fastify-vulnerability branch from 146e9f8 to ff0b827 Compare October 13, 2026 16:32
@renovate
renovate Bot force-pushed the renovate/npm-nestjs-platform-fastify-vulnerability branch 3 times, most recently from 1b8a4f5 to 1e12835 Compare October 26, 2026 23:06
@renovate
renovate Bot force-pushed the renovate/npm-nestjs-platform-fastify-vulnerability branch from 1e12835 to 6114eb0 Compare November 2, 2026 13:15
@renovate
renovate Bot force-pushed the renovate/npm-nestjs-platform-fastify-vulnerability branch from 6114eb0 to c2165d7 Compare November 6, 2026 03:13

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants