refactor(security): make the redirect-loop bound explicit in the for header

The manual redirect loop used an empty-condition for(;;) with the bound enforced only by an internal break; termination was correct but read like a mistake. Put the MAX_REDIRECTS bound in the loop header. No behavior change — the internal break still fires first.
This commit is contained in:
Paulo Castellano 2026-07-17 15:49:12 -03:00
parent 4a08913d70
commit 2815a45de8

View file

@ -44,7 +44,7 @@ public function get(string $url): Response
// hop's Location target is re-validated against the SSRF guard before it is
// ever requested. A public page could otherwise 302 to an internal host and
// Guzzle's built-in redirect following would fetch it without re-checking.
for ($hop = 0; ; $hop++) {
for ($hop = 0; $hop <= self::MAX_REDIRECTS; $hop++) {
try {
$response = Http::timeout(self::TIMEOUT_SECONDS)
->withUserAgent(self::USER_AGENT)