-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Line breaks in Base64 encoded LogoutResponse cause an IllegalArgumentException #10923
Comments
Thanks, @chschu, for reporting this. I agree that the spec in various places indicates RFC2045 must be used and in one place it loosely says that lines can be wrapped at "a reasonable length". These two are somewhat in conflict since RFC2045 line-wraps at a specific length. I agree that one practical way to address this is to change |
Yes, the MIME decoder would be able to decode a |
Describe the bug
If the
SAMLResponse
parameter for Single Logout contains line breaks, Base64 decoding fails with anIllegalArgumentException
:Because the same
Saml2Utils
class is used to decode theLogoutRequest
, the issue should also occur there.During authentication, the
SAMLResponse
is Base64-decoded usingorg.apache.commons.codec.binary.Base64
, and line breaks are not an issue there.To Reproduce
Capture the POST to
/logout/saml2/slo
, add some%0D
and/or%0A
to theSAMLResponse
parameter, and submit the POST request. Alternatively, have an asserting party that produces aSAMLResponse
containing line breaks.Expected behavior
Single Logout should accept newlines in the
SAMLResponse
request parameter.According to https://docs.oasis-open.org/security/saml/v2.0/saml-bindings-2.0-os.pdf, line 793: "The base64-encoded value MAY be line-wrapped at a reasonable length in accordance with common practice."
The document is not clear about the specific Base64 format to be used in this context, but it refers to RFC2045 in some other contexts. RFC2045 is implemented by
java.util.Base64.getMimeEncoder()
.The text was updated successfully, but these errors were encountered: