From 61c78b400e95132d7f44c2a32204ee12721c33f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= Date: Sat, 5 Sep 2026 22:24:11 +0200 Subject: [PATCH] fix(rules): set a timeout on the rules fetch request fetchRules() issued its GET without a timeout, so a stalled connection to the rules endpoint could hang the cron job or the sync-rules CLI command indefinitely and block the sansec cron group. Set a 30 second timeout, matching the pattern already used by Report::sendReport(). --- Model/Rules.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Model/Rules.php b/Model/Rules.php index ab15cb8..39e5fda 100644 --- a/Model/Rules.php +++ b/Model/Rules.php @@ -15,6 +15,7 @@ class Rules { private const PROTOCOL_VERSION = '1'; private const FLAG_CODE = 'sansec_shield_rules'; + private const RULES_FETCH_TIMEOUT = 30; /** @var Config */ private $config; @@ -76,6 +77,7 @@ private function fetchRules(): array { $curl = $this->curlFactory->create(); $curl->setCredentials($this->config->getLicenseKey(), $this->config->getLicenseKey()); + $curl->setTimeout(self::RULES_FETCH_TIMEOUT); $curl->get(sprintf("%s?v=%d", $this->config->getRulesUrl(), self::PROTOCOL_VERSION)); if ($curl->getStatus() !== 200) {