8000 BACKPORT: Apply browser security headers on SP-initiated SAML endpoints (#54159) by edewit · Pull Request #55043 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

BACKPORT: Apply browser security headers on SP-initiated SAML endpoints (#54159) - #55043

Merged
mposolda merged 2 commits into
keycloak:release/26.8from
edewit:backport-54159-26.8
Nov 12, 2026
Merged

mposolda merged 2 commits into
keycloak:release/26.8from
edewit:backport-54159-26.8

Conversation

@edewit
@edewit edewit commented Nov 11, 2026
Copy link
Copy Markdown
Contributor
  • Apply browser security headers on SP-initiated SAML endpoints

Return Response synchronously from /protocol/saml GET/POST (including
artifact resolution) so KeycloakSecurityHeadersFilter can apply realm
browser security headers. Previously @suspended AsyncResponse closed the
session before the filter ran, omitting CSP and X-Frame-Options.

Closes #54122
(cherry picked from commit 42a3b96)

…ak#54159)

* Apply browser security headers on SP-initiated SAML endpoints

Return Response synchronously from /protocol/saml GET/POST (including
artifact resolution) so KeycloakSecurityHeadersFilter can apply realm
browser security headers. Previously @suspended AsyncResponse closed the
session before the filter ran, omitting CSP and X-Frame-Options.

Closes keycloak#54122

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* Keep SAML artifact resolution on saml-artifact-pool

Restore async artifact SOAP I/O so a slow SP does not block shared HTTP
workers, while still applying realm browser security headers before
AsyncResponse resume for SP-initiated SAML endpoints.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* Preserve front-channel logout CSP when applying SAML security headers

Route async SAML header application through SecurityHeadersProvider so
allowFrameSrc from FrontChannelLogoutHandler is not overwritten by raw
realm defaults.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* Apply SAML security headers after AsyncResponseTransaction selects the final response

Rollback-generated artifact error pages were missing realm browser security
headers because they replaced an already-decorated success response. Apply
headers on commit/rollback after the final response is chosen, and cover the
artifact resolution rollback path in SamlSecurityHeadersTest.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* Rebuild SAML responses when applying browser security headers

Mutating Response.getHeaders() is not propagated by Quarkus REST on
AsyncResponse resume. Rebuild the Response via Response.fromResponse
so realm security headers are present on the wire.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

---------

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
(cherry picked from commit 42a3b96)
@edewit
edewit requested a review from a team as a code owner November 11, 2026 14:18
@mposolda mposolda self-assigned this Nov 12, 2026
@mposolda mposolda left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edewit There is compilation failure, which looks related. Can you take a look?

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.
9A48
com>
@mposolda
mposolda merged commit 4ee3b55 into keycloak:release/26.8 Nov 12, 2026
152 of 154 checks passed
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.

2 participants

0