Two issues in the Scalar starters are fixed in these releases. Both were reported together and ship in the same versions.
Impact 1 — the whole application trusts client-supplied forwarded headers (CWE-1188)
The Scalar starters registered a forwarded-header handler as an application-wide bean: ForwardedHeaderFilter on the servlet stack and ForwardedHeaderTransformer on the reactive stack.
Those beans are not scoped to the Scalar documentation endpoints. Registering them makes the entire application trust the Forwarded and X-Forwarded-* headers of every caller, silently overriding Spring Boot's server.forward-headers-strategy=none default. An application that added a Scalar starter — and that is not behind a reverse proxy which strips or rewrites those headers — would begin deriving scheme, host and port from attacker-controlled input.
Any part of the application that builds absolute URLs is then influenced by the caller: generated links, redirects, Location headers and URLs embedded in emails such as password-reset links. This is the classic host-header poisoning precondition, and it applied to the whole application rather than to springdoc's own endpoints.
Impact 2 — Scalar pages were rendered from a shared mutable bean (CWE-362)
AbstractScalarController wrote request-specific state — the api-docs URL derived from the current request, and the group sources — back onto the singleton ScalarProperties bean while serving the request.
Because the bean is shared by every request, concurrent callers raced on it. One caller's api-docs URL, derived from their own Host or forwarded headers, could be rendered into a different caller's Scalar page. When groups are configured the controller performed two successive writes, so a request landing between them could render a page whose url was null.
Affected
Applications with springdoc-openapi-starter-webmvc-scalar or springdoc-openapi-starter-webflux-scalar on the classpath. Both issues affect the Spring Boot 3 and Spring Boot 4 lines.
Patches
Fixed in 2.9.1 and 3.1.1.
The Scalar starters no longer register a ForwardedHeaderFilter or a ForwardedHeaderTransformer; forwarded-header handling is left entirely to the application's own configuration, as it is for every other Spring Boot application. AbstractScalarController now copies the configured properties and applies request-specific state only to the per-request copy, leaving the singleton untouched.
Upgrade note. If your application runs behind a trusted reverse proxy and relied on the removed bean, enable forwarded-header support explicitly:
server.forward-headers-strategy=framework
(or native when the proxy support is provided by the container). Enable it only when a trusted proxy is guaranteed to overwrite the incoming forwarded headers.
Workarounds
Ensure your reverse proxy strips or overwrites client-supplied Forwarded and X-Forwarded-* headers. There is no workaround for the rendering race other than upgrading.
References
921e1f4a6 – stop trusting forwarded headers application-wide (4.x)
593ee5280 – render Scalar from a request-local properties copy (4.x)
67abb9036 – defer forwarded-header handling to the application (2.x)
6316b2cb1 – render the Scalar page from request-local state (2.x)
Credits
Reported by Scrutineer (Alpha-Omega).
Two issues in the Scalar starters are fixed in these releases. Both were reported together and ship in the same versions.
Impact 1 — the whole application trusts client-supplied forwarded headers (CWE-1188)
The Scalar starters registered a forwarded-header handler as an application-wide bean:
ForwardedHeaderFilteron the servlet stack andForwardedHeaderTransformeron the reactive stack.Those beans are not scoped to the Scalar documentation endpoints. Registering them makes the entire application trust the
ForwardedandX-Forwarded-*headers of every caller, silently overriding Spring Boot'sserver.forward-headers-strategy=nonedefault. An application that added a Scalar starter — and that is not behind a reverse proxy which strips or rewrites those headers — would begin deriving scheme, host and port from attacker-controlled input.Any part of the application that builds absolute URLs is then influenced by the caller: generated links, redirects,
Locationheaders and URLs embedded in emails such as password-reset links. This is the classic host-header poisoning precondition, and it applied to the whole application rather than to springdoc's own endpoints.Impact 2 — Scalar pages were rendered from a shared mutable bean (CWE-362)
AbstractScalarControllerwrote request-specific state — the api-docs URL derived from the current request, and the group sources — back onto the singletonScalarPropertiesbean while serving the request.Because the bean is shared by every request, concurrent callers raced on it. One caller's api-docs URL, derived from their own
Hostor forwarded headers, could be rendered into a different caller's Scalar page. When groups are configured the controller performed two successive writes, so a request landing between them could render a page whoseurlwasnull.Affected
Applications with
springdoc-openapi-starter-webmvc-scalarorspringdoc-openapi-starter-webflux-scalaron the classpath. Both issues affect the Spring Boot 3 and Spring Boot 4 lines.Patches
Fixed in 2.9.1 and 3.1.1.
The Scalar starters no longer register a
ForwardedHeaderFilteror aForwardedHeaderTransformer; forwarded-header handling is left entirely to the application's own configuration, as it is for every other Spring Boot application.AbstractScalarControllernow copies the configured properties and applies request-specific state only to the per-request copy, leaving the singleton untouched.Upgrade note. If your application runs behind a trusted reverse proxy and relied on the removed bean, enable forwarded-header support explicitly:
server.forward-headers-strategy=framework(or
nativewhen the proxy support is provided by the container). Enable it only when a trusted proxy is guaranteed to overwrite the incoming forwarded headers.Workarounds
Ensure your reverse proxy strips or overwrites client-supplied
ForwardedandX-Forwarded-*headers. There is no workaround for the rendering race other than upgrading.References
921e1f4a6– stop trusting forwarded headers application-wide (4.x)593ee5280– render Scalar from a request-local properties copy (4.x)67abb9036– defer forwarded-header handling to the application (2.x)6316b2cb1– render the Scalar page from request-local state (2.x)Credits
Reported by Scrutineer (Alpha-Omega).