Skip to content

Commit 1ae39c2

Browse files
committed
Address PR review feedback
- Fix comparison operators: Use >= instead of > for maxDepth and maxEncodingLevels This correctly blocks URLs when they meet or exceed the threshold - Replace empty() with ! for enabled check (cleaner intent) - All tests still pass (312 tests, 926 assertions) Addresses feedback from @ADmad and @Copilot in PR #752
1 parent 56130d3 commit 1ae39c2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/AuthenticationService.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,21 +503,21 @@ protected function validateRedirect(string $redirect): ?string
503503
$config = $this->getConfig('redirectValidation');
504504

505505
// If validation is disabled, return the URL as-is (backward compatibility)
506-
if (empty($config['enabled'])) {
506+
if (!$config['enabled']) {
507507
return $redirect;
508508
}
509509

510510
$decodedUrl = urldecode($redirect);
511511

512512
// Check for nested redirect parameters
513513
$redirectCount = substr_count($decodedUrl, 'redirect=');
514-
if ($redirectCount > $config['maxDepth']) {
514+
if ($redirectCount >= $config['maxDepth']) {
515515
return null;
516516
}
517517

518518
// Check for multiple encoding levels (e.g., %25 = percent-encoded %)
519519
$encodingCount = substr_count($redirect, '%25');
520-
if ($encodingCount > $config['maxEncodingLevels']) {
520+
if ($encodingCount >= $config['maxEncodingLevels']) {
521521
return null;
522522
}
523523

0 commit comments

Comments
 (0)