Skip to main content
Menu
Advisories

Micronaut server filters scoped by the context path do not run on function, WebSocket and prefix-colliding routes

GHSA-GJ4V-R6X3-66JPPublished Updated GitHub

Description

When micronaut.server.context-path is set, server filter patterns are prefixed with the context path, but several route kinds are not mounted under it consistently. @FunctionBean routes and @ServerWebSocket upgrades are served outside the context path, so a context-path-scoped filter (including a global /** authentication filter) never runs for them. REGEX filter patterns are joined to the context path with a URI path joiner, so anchored or alternated expressions silently stop matching, and filter or static-resource patterns that merely begin with the context-path string are not prefixed while the routes they guard are. An unauthenticated client can reach endpoints that the application believes are protected by a filter. The fix is to compute the effective mount path of every route kind and filter pattern in one place and to prefix REGEX patterns as patterns, not as paths.

Affected and patched versions

Function and WebSocket route registration and context-path filter prefixing predate 3.0.0. F22 requires the REGEX pattern style, available in 3.x and later.

PackageAffected versionsPatched version
io.micronaut:micronaut-http-server-netty< 3.10.193.10.19
io.micronaut:micronaut-http-server-netty>= 4.0.0, < 4.10.374.10.37
io.micronaut:micronaut-http-server-netty>= 5.0.0, < 5.2.235.2.23
io.micronaut:micronaut-router< 3.10.193.10.19
io.micronaut:micronaut-router>= 4.0.0, < 4.10.374.10.37
io.micronaut:micronaut-router>= 5.0.0, < 5.2.235.2.23
io.micronaut:micronaut-function-web< 3.10.193.10.19
io.micronaut:micronaut-function-web>= 4.0.0, < 4.10.374.10.37
io.micronaut:micronaut-function-web>= 5.0.0, < 5.2.235.2.23
io.micronaut:micronaut-core< 3.10.193.10.19
io.micronaut:micronaut-core>= 4.0.0, < 4.10.374.10.37
io.micronaut:micronaut-core>= 5.0.0, < 5.2.235.2.23

The 3.x fix is in commit cca22779fb, first included in stable release 3.10.19. The last affected stable 3.10.x release is 3.10.18.

Findings

  • F01 (= ANT-2026-M3ERVTCE)
  • F21
  • F22 (= ANT-2026-LX2W055I)
  • F26 (= ANT-2026-RNE5JPDX)

Affected versions

References

GitHub · micronaut-projects/micronaut-core