npm @fastify/swagger-ui 6.1.5
v6.1.5

one hour ago

Security

This release fixes GHSA-j7qm-jhpc-mj26 (CVE-2026-133273): documentation authentication bypass via the unprotected /static route. Severity: Low (CVSS 3.7, CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N), CWE-288.

uiHooks (the onRequest and preHandler hooks used to put the documentation behind a login) were applied to every route the plugin adds except the @fastify/static instance mounted at <routePrefix>/static/. When baseDir is set, that instance serves every file in baseDir, so a file protected at <routePrefix>/<file> was also readable without credentials at <routePrefix>/static/<file>. Access was read-only, and the /json, /yaml and UI page routes stayed protected.

  • Affected versions: >= 2.1.0, < 6.1.5
  • Patched version: 6.1.5

What changed: the uiHooks now run for the /static route too, so the bundled Swagger UI assets are served behind the same hooks as the rest of the documentation. Basic and cookie/session authentication keep working because the browser sends same-origin credentials for those requests. If you use a header-only bearer scheme, or a proxy that injects authentication, you may need to serve the assets from a separate public path or put an authentication-aware same-origin proxy in front.

Workarounds if you cannot upgrade: enforce authentication in a Fastify hook registered before @fastify/swagger-ui so it also runs for the /static route, or do not set baseDir (without it, only the public bundled assets are served under /static/).

Thanks to @mercury-redstone-research for the report, @mcollina for the fix and @UlisesGascon for the review.

What's Changed

New Contributors

Full Changelog: v6.1.4...v6.1.5

Don't miss a new swagger-ui release

NewReleases is sending notifications on new releases.