-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Enhance parsing of StatusCode in SAML Responses #38628
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
Conversation
<Status> elements in a failed response might contain two nested <StatusCode> elements. We currently only parse the first one in order to create a message that we attach to the Exception we return and log. However this is generic and only gives out informarion about whether the SAML IDP believes it's an error with the request or if it couldn't handle the request for other reasons. The encapsulated StatusCode has a more interesting error message that potentially gives out the actual error as in Invalid nameid policy, authentication failure etc. This change ensures that we print that information also, and removes Message and Details fields from the message when these are not part of the Status element (which quite often is the case)
Pinging @elastic/es-security |
That list of version labels doesn't look right:
|
StatusCode subLevel = firstLevel.getStatusCode(); | ||
StringBuilder sb = new StringBuilder(); | ||
if (StatusCode.REQUESTER.equals(firstLevel.getValue())) { | ||
sb.append("The request could not be granted due to an error in the Elastic Stack side ("); |
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.
I don't think this gives an accurately picture. In reality it's the IdP thinks the Requester did something wrong.
The IdP's assessment might be true (or in the case of ADFS, it's probably not) but in either case if we say ther eis an error in the Elastic Stack side
, it implies that we know about a problem, which we don't.
I fear it will lead to users hunting for error messages, or expecting us to explain the error, when we don't know what the problem is (if we did, we wouldn't have made the request).
sb.append("The request could not be granted due to an error in the Elastic Stack side ("); | |
sb.append("The SAML IdP did not grant the request. It indicated that the Elastic Stack side sent something invalid ("); |
sb.append("The request could not be granted because the SAML IDP doesn't support SAML 2.0 ("); | ||
} else { | ||
sb.append("The request could not be granted, the SAML IDP responded with a non-standard Status code ("); | ||
|
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.
Nit:
unneccessary
new
line
This needs to be labelled for |
* Enhance parsing of StatusCode in SAML Responses <Status> elements in a failed response might contain two nested <StatusCode> elements. We currently only parse the first one in order to create a message that we attach to the Exception we return and log. However this is generic and only gives out informarion about whether the SAML IDP believes it's an error with the request or if it couldn't handle the request for other reasons. The encapsulated StatusCode has a more interesting error message that potentially gives out the actual error as in Invalid nameid policy, authentication failure etc. This change ensures that we print that information also, and removes Message and Details fields from the message when these are not part of the Status element (which quite often is the case)
* Enhance parsing of StatusCode in SAML Responses <Status> elements in a failed response might contain two nested <StatusCode> elements. We currently only parse the first one in order to create a message that we attach to the Exception we return and log. However this is generic and only gives out informarion about whether the SAML IDP believes it's an error with the request or if it couldn't handle the request for other reasons. The encapsulated StatusCode has a more interesting error message that potentially gives out the actual error as in Invalid nameid policy, authentication failure etc. This change ensures that we print that information also, and removes Message and Details fields from the message when these are not part of the Status element (which quite often is the case)
* Enhance parsing of StatusCode in SAML Responses <Status> elements in a failed response might contain two nested <StatusCode> elements. We currently only parse the first one in order to create a message that we attach to the Exception we return and log. However this is generic and only gives out informarion about whether the SAML IDP believes it's an error with the request or if it couldn't handle the request for other reasons. The encapsulated StatusCode has a more interesting error message that potentially gives out the actual error as in Invalid nameid policy, authentication failure etc. This change ensures that we print that information also, and removes Message and Details fields from the message when these are not part of the Status element (which quite often is the case)
* Enhance parsing of StatusCode in SAML Responses <Status> elements in a failed response might contain two nested <StatusCode> elements. We currently only parse the first one in order to create a message that we attach to the Exception we return and log. However this is generic and only gives out informarion about whether the SAML IDP believes it's an error with the request or if it couldn't handle the request for other reasons. The encapsulated StatusCode has a more interesting error message that potentially gives out the actual error as in Invalid nameid policy, authentication failure etc. This change ensures that we print that information also, and removes Message and Details fields from the message when these are not part of the Status element (which quite often is the case)
<Status>
elements in a failed response might contain two nested<StatusCode>
elements. We currently only parse the first one inorder to create a message that we attach to the Exception we return
and log. However this is generic and only gives out information
about whether the SAML IDP believes it's an error with the
request or if it couldn't handle the request for other reasons. The
encapsulated
<StatusCode>
has a more interesting error message thatpotentially gives out the actual error as in Invalid NameID policy,
authentication failure etc.
This change ensures that we print the nested information also, and
removes Message and Details fields from the message when these
are not part of the Status element (which quite often is the case)