Commit 597d64c9 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:ambulance: fix(CSRFProtection) Split HTTP_X_FORWARDED_HOST to take only the first value

If there are several proxies it may contain several values
 comma-separated

issue #5935
Showing with 2 additions and 1 deletion
+2 -1
......@@ -56,7 +56,8 @@ class CSRFProtection
$origin = preg_replace('|^[^/]+://([^/]+)(/.*)?$|', '\1', $origin);
$target = FALSE;
if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
$target = $_SERVER['HTTP_X_FORWARDED_HOST'];
/* Only take the first value, there may be several separated by commas */
list($target) = explode(',', $_SERVER['HTTP_X_FORWARDED_HOST'], 2);
} else
if (!empty($_SERVER['HTTP_HOST'])) {
$target = $_SERVER['HTTP_HOST'];
......
  • bmortier @bmortier

    mentioned in commit 343ee2ae

    By Côme Chilliet on 2018-12-18T13:55:27 (imported from GitLab)

    ·

    mentioned in commit 343ee2ae

    By Côme Chilliet on 2018-12-18T13:55:27 (imported from GitLab)

    Toggle commit list
  • bmortier @bmortier

    mentioned in merge request !478

    By Côme Chilliet on 2018-12-18T13:55:43 (imported from GitLab)

    ·

    mentioned in merge request !478

    By Côme Chilliet on 2018-12-18T13:55:43 (imported from GitLab)

    Toggle commit list
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment