Harden PHP feeds: block direct cache access, cap curl redirects

Security review found no exploitable issue — none of the 3 endpoints
accept user input, so there's no injection surface (upstream URLs are
hardcoded constants, output is XML-escaped). These are defense-in-depth
only: deny direct HTTP access to cache/, and cap CURLOPT_MAXREDIRS to
avoid a hung request on a misbehaving upstream.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
para
2026-09-25 22:19:36 +02:00
co-authored by Claude Sonnet 5
parent 896454aeea
commit a46e9c64a2
2 changed files with 4 additions and 0 deletions
+1
View File
@@ -30,6 +30,7 @@ function http_get(string $url, array $extraHeaders = []): string
CURLOPT_HTTPHEADER => array_merge(['Accept: application/json'], $extraHeaders),
CURLOPT_TIMEOUT => 20,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_MAXREDIRS => 3,
]);
$body = curl_exec($ch);
$errno = curl_errno($ch);