You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
#667 HTTP-Redirect signature validation with retrieveParametersFromServer: SAMLRequest, SAMLResponse, RelayState, SigAlg and Signature are matched against the complete field names of the query string, instead of searched as substrings of it. A signed Logout Request/Response with one of those names inside a value or inside the name of another parameter (for example RelayState=Signature) is now validated; it was rejected with "Duplicate parameter in query string" or "Both SAMLRequest and SAMLResponse provided". A message signed with an empty RelayState (RelayState=&SigAlg=...) is now validated; its signature validation failed
Security: with retrieveParametersFromServer, a field that PHP parses as one of those parameters (its name has leading spaces, percent-encoded characters, a NUL byte or array brackets) counts as that parameter, so a query string with a second SAMLRequest, SAMLResponse, RelayState, SigAlg or Signature sent that way is rejected with "Duplicate parameter in query string". The message is also rejected ("The SAMLRequest parameter does not match the one of the query string", same for SAMLResponse, RelayState and SigAlg) when the value that PHP parsed is not the value of the query string that the signature covers. Before, the signature of a message could be verified while a different message was processed
Compatibility notes. Only affect the HTTP-Redirect binding when retrieveParametersFromServer is true:
OneLogin_Saml2_Utils::extractOriginalQueryParam only returns the value of the field with exactly that name, and an empty string when there is no such field (it returned an unrelated piece of the query string). A name that is part of another name or value, or that comes after a leading ? at $_SERVER['QUERY_STRING'], is not found anymore
OneLogin_Saml2_Utils::validateBinarySign requires that its $getData holds the values parsed from $_SERVER['QUERY_STRING']. If the application changes the SAMLRequest/SAMLResponse, RelayState or SigAlg values of $_GET (adds slashes, trims them...) or sets $_SERVER['QUERY_STRING'] itself with other content, the message is rejected. On PHP 5.3 that is also the case of a RelayState with quotes or backslashes when magic_quotes_gpc is enabled
A query string with an alias of a reserved parameter is rejected even if the alias has no effect (it comes before the signed parameter or repeats its value)
Parameters that only have a reserved name inside their name (SigAlgorithm, xSAMLRequest...) are ignored; they were a "Duplicate parameter in query string"
The messages returned by getLastErrorReason()/getError() for those requests change accordingly
When the protocol is a list of values separated by commas (the X-Forwarded-Proto header of a chain of proxies, https,http), the first value is used in OneLogin_Saml2_Utils::getSelfProtocol, as X-Forwarded-Host already did
When X-Forwarded-Host or X-Forwarded-Port are lists of values separated by commas, the first value is used without the spaces around it
Add a test for OneLogin_Saml2_Utils::setBaseURL ignoring a boolean true (it does not clear the base URL that was set)
Refactor Signature validation on Signed Responses with Encrypted Assertion
Add validation for Assertion Version
#658OneLogin_Saml2_IdPMetadataParser::parseRemoteXML accepts extra curl options in a new optional $curlOptions parameter. They are applied last, so they override the ones that the method sets (except CURLOPT_RETURNTRANSFER); options that are not valid raise an Exception. The request now has default timeouts: 10 seconds to connect and 120 seconds in total (it had none), use $curlOptions to change them