Skip to content

Commit 5ab552a

Browse files
committed
Check destination against the getSelfURLNoQuery as well on LogoutRequest and LogoutResponse as we do on Response
1 parent edbab29 commit 5ab552a

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

lib/Saml2/LogoutRequest.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,15 @@ public function isValid($retrieveParametersFromServer = false)
365365
// Check destination
366366
if ($dom->documentElement->hasAttribute('Destination')) {
367367
$destination = $dom->documentElement->getAttribute('Destination');
368-
if (!empty($destination) && strpos($destination, $currentURL) === false) {
369-
throw new OneLogin_Saml2_ValidationError(
370-
"The LogoutRequest was received at $currentURL instead of $destination",
371-
OneLogin_Saml2_ValidationError::WRONG_DESTINATION
372-
);
368+
if (!empty($destination) && strpos($destination, $currentURL) !== 0) {
369+
$currentURLNoRouted = OneLogin_Saml2_Utils::getSelfURLNoQuery();
370+
371+
if (strpos($destination, $currentURLNoRouted) !== 0) {
372+
throw new OneLogin_Saml2_ValidationError(
373+
"The LogoutRequest was received at $currentURL instead of $destination",
374+
OneLogin_Saml2_ValidationError::WRONG_DESTINATION
375+
);
376+
}
373377
}
374378
}
375379

lib/Saml2/LogoutResponse.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,15 @@ public function isValid($requestId = null, $retrieveParametersFromServer = false
161161
// Check destination
162162
if ($this->document->documentElement->hasAttribute('Destination')) {
163163
$destination = $this->document->documentElement->getAttribute('Destination');
164-
if (!empty($destination) && strpos($destination, $currentURL) === false) {
165-
throw new OneLogin_Saml2_ValidationError(
166-
"The LogoutResponse was received at $currentURL instead of $destination",
167-
OneLogin_Saml2_ValidationError::WRONG_DESTINATION
168-
);
164+
if (!empty($destination) && strpos($destination, $currentURL) !== 0) {
165+
$currentURLNoRouted = OneLogin_Saml2_Utils::getSelfURLNoQuery();
166+
167+
if (strpos($destination, $currentURLNoRouted) !== 0) {
168+
throw new OneLogin_Saml2_ValidationError(
169+
"The LogoutResponse was received at $currentURL instead of $destination",
170+
OneLogin_Saml2_ValidationError::WRONG_DESTINATION
171+
);
172+
}
169173
}
170174
}
171175

0 commit comments

Comments
 (0)