Skip to content

Commit

Permalink
Merge pull request #93 from SURFnet/bugfix/locale-switch-return-url-s…
Browse files Browse the repository at this point in the history
…ecurity

Prevent attackers from submitting illegal return URLs
  • Loading branch information
rjkip committed Sep 30, 2015
2 parents a863b3b + 9ae8b54 commit 1ba8b77
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public function switchLocaleAction(Request $request)
{
$returnUrl = $request->query->get('return-url');

$domain = $request->getSchemeAndHttpHost();
// Return URLs generated by us always include a path (ie. at least a forward slash)
// @see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/Request.php#L878
$domain = $request->getSchemeAndHttpHost() . '/';
if (strpos($returnUrl, $domain) !== 0) {
$this->get('logger')->error(sprintf(
'Identity "%s" used illegal return-url for redirection after changing locale, aborting request',
Expand Down

0 comments on commit 1ba8b77

Please sign in to comment.