8000 Fix login redirect when referer contains a query string by fabpot · Pull Request #23580 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Fix login redirect when referer contains a query string #23580

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

Merged
merged 4 commits into from
Jul 19, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Security] fixed default target path when referer contains a query st…
…ring
  • Loading branch information
fabpot committed Jul 19, 2017
commit 9c7a1406cb81f4d1ccd7e3521347e2d847b7467c
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,14 @@ protected function determineTargetUrl(Request $request)
return $targetUrl;
}

if ($this->options['use_referer'] && ($targetUrl = $request->headers->get('Referer')) && $targetUrl !== $this->httpUtils->generateUri($request, $this->options['login_path'])) {
return $targetUrl;
if ($this->options['use_referer']) {
$targetUrl = $request->headers->get('Referer');
if (false !== $pos = strpos($targetUrl, '?')) {
$targetUrl = substr($targetUrl, 0, $pos);
}
if ($targetUrl !== $this->httpUtils->generateUri($request, $this->options['login_path'])) {
return $targetUrl;
}
}

return $this->options['default_target_path'];
Expand Down
0