fix(security): replace REQUEST_URI with fixed path in redirects (#43)
All checks were successful
Deploy Feature Branch to Test / deploy (push) Successful in 24s
Lint / PHP Syntax Check (push) Successful in 33s
Lint / CSS Lint (stylelint) (push) Successful in 1m14s
Lint / HTML Lint (htmlhint) (push) Successful in 1m8s
Lint / PHP Syntax Check (pull_request) Successful in 32s
Lint / CSS Lint (stylelint) (pull_request) Successful in 1m12s
Lint / HTML Lint (htmlhint) (pull_request) Successful in 1m8s
All checks were successful
Deploy Feature Branch to Test / deploy (push) Successful in 24s
Lint / PHP Syntax Check (push) Successful in 33s
Lint / CSS Lint (stylelint) (push) Successful in 1m14s
Lint / HTML Lint (htmlhint) (push) Successful in 1m8s
Lint / PHP Syntax Check (pull_request) Successful in 32s
Lint / CSS Lint (stylelint) (pull_request) Successful in 1m12s
Lint / HTML Lint (htmlhint) (pull_request) Successful in 1m8s
- Replace all 3 occurrences of $_SERVER['REQUEST_URI'] with '/' - Prevents potential open redirect via client-controlled REQUEST_URI - Safe since contact form only exists on homepage Fix #43
This commit is contained in:
@@ -51,7 +51,7 @@ class HomeController extends Controller
|
|||||||
|
|
||||||
$honeypot = $normalizeContactValue((string) ($_POST['website'] ?? ''));
|
$honeypot = $normalizeContactValue((string) ($_POST['website'] ?? ''));
|
||||||
if ($honeypot !== '') {
|
if ($honeypot !== '') {
|
||||||
header('Location: ' . $_SERVER['REQUEST_URI'] . '#form-result');
|
header('Location: /#form-result');
|
||||||
$_SESSION['form_success'] = true;
|
$_SESSION['form_success'] = true;
|
||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
@@ -102,7 +102,7 @@ class HomeController extends Controller
|
|||||||
|
|
||||||
if ($mailSent) {
|
if ($mailSent) {
|
||||||
$_SESSION['last_contact_submit'] = time();
|
$_SESSION['last_contact_submit'] = time();
|
||||||
header('Location: ' . $_SERVER['REQUEST_URI'] . '#form-result');
|
header('Location: /#form-result');
|
||||||
$_SESSION['form_success'] = true;
|
$_SESSION['form_success'] = true;
|
||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
@@ -111,7 +111,7 @@ class HomeController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($formErrors)) {
|
if (!empty($formErrors)) {
|
||||||
header('Location: ' . $_SERVER['REQUEST_URI'] . '#form-result');
|
header('Location: /#form-result');
|
||||||
$_SESSION['form_errors'] = $formErrors;
|
$_SESSION['form_errors'] = $formErrors;
|
||||||
$_SESSION['form_data'] = $formData;
|
$_SESSION['form_data'] = $formData;
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
Reference in New Issue
Block a user