Repository navigation
Close limited SOAP request streams in SAML endpoints - #55171
Merged
Merged
Conversation
Closes keycloak#55169 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
ahus1
force-pushed
the
is-55169-close-saml-soap-streams
branch
from
November 13, 2026 16:38
eb44a7e to
da4bbf8
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The outer resource block in SamlService closes the same stream already closed by authenticate(InputStream), duplicating stream ownership and close-error handling around response processing.
1 open issue
What changed in this PR
This PR addresses the Checker Framework resource-leak errors reported in #55169 by explicitly closing limited SOAP request streams in Keycloak’s SAML endpoints.
Changes:
- Adds try-with-resources and SOAP fault handling for stream-close failures.
- Separates ECP message extraction and stream closure from document authentication.
| File | Description |
|---|---|
services/src/main/java/org/keycloak/protocol/saml/SamlService.java |
Adds stream closure around artifact resolution parsing and ECP delegation. |
services/src/main/java/org/keycloak/protocol/saml/profile/ecp/SamlEcpProfileService.java |
Closes the limited stream after extraction, before authenticating the document. |
Review effort: Balanced
Simplified SOAP binding by removing input stream limitation and error handling. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Alexander Schwartz <alexander.schwartz@gmx.net>
ahus1
marked this pull request as ready for review
November 13, 2026 17:20
pedroigor
approved these changes
Nov 13, 2026
ahus1
enabled auto-merge (squash)
November 13, 2026 17:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #55169
Decisions and assumptions:
@MustCallAlias, to keep annotations to a minimum and to not rely on the container closing the request stream.try, so a failure onclose()can't turn an already built response into a SOAP fault.limit(...)call sites but no Checker Framework setup.