-
Notifications
You must be signed in to change notification settings - Fork 967
Make SAML relayState max length configurable #6381
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
base: main
Are you sure you want to change the base?
Conversation
The default `SsoHandler` currently omits `relayState` when its length exceeds 80 characters. Although the SAML spec defines an 80-character limit, many implementations do not strictly enforce it, and this restriction is often too tight in practice. References: - https://docs.oasis-open.org/security/saml/v2.0/saml-bindings-2.0-os.pdf - https://help.salesforce.com/s/articleView?id=000387925&type=1 Modifications: - Introduced `SamlServiceProviderBuilder.relayStateMaxLength()` to configure the maximum length. Result: - You can override the default 80-character restriction for SAML relayState.
| // The value MUST NOT exceed 80 bytes in length and SHOULD be integrity protected by the entity | ||
| // creating the message independent of any other protections that may or may not exist | ||
| // during message transmission. | ||
| if (relayState.length() > 80) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to check the relayState length here because it's not set in the default SsoHandler if it exceeds 80 characters, so let me just remove this condition.
Additionally, we were not checking this limit in the post binding, even though the Spec says it should.
ikhoon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 👍
Motivation:
The default
SsoHandlercurrently omitsrelayStatewhen its length exceeds 80 characters. Although the SAML spec defines an 80-character limit, many implementations do not strictly enforce it, and this restriction is often too tight in practice.References:
Modifications:
SamlServiceProviderBuilder.relayStateMaxLength()to configure the maximum length.Result: