From a21604cd7b9578366dd7d1eb0e3088d78b6e3017 Mon Sep 17 00:00:00 2001 From: FreddleSpl0it <75116288+FreddleSpl0it@users.noreply.github.com> Date: Wed, 28 Oct 2026 17:06:17 +0100 Subject: [PATCH] [Web][Rspamd] Quarantine link adjustments --- data/conf/rspamd/meta_exporter/pipe.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/data/conf/rspamd/meta_exporter/pipe.php b/data/conf/rspamd/meta_exporter/pipe.php index ab0d1faa0..c0e056c6a 100644 --- a/data/conf/rspamd/meta_exporter/pipe.php +++ b/data/conf/rspamd/meta_exporter/pipe.php @@ -216,8 +216,9 @@ foreach ($rcpts as $rcpt) { foreach ($rcpt_final_mailboxes as $rcpt_final) { error_log("QUARANTINE: quarantine pipe: processing quarantine message for rcpt " . $rcpt_final . PHP_EOL); try { - $stmt = $pdo->prepare("INSERT INTO `quarantine` (`qid`, `subject`, `score`, `sender`, `rcpt`, `symbols`, `user`, `ip`, `msg`, `action`, `fuzzy_hashes`) - VALUES (:qid, :subject, :score, :sender, :rcpt, :symbols, :user, :ip, :msg, :action, :fuzzy_hashes)"); + // qhash is the secret of the release/delete links in notifications, so it must not be derivable + $stmt = $pdo->prepare("INSERT INTO `quarantine` (`qid`, `subject`, `score`, `sender`, `rcpt`, `symbols`, `user`, `ip`, `msg`, `action`, `fuzzy_hashes`, `qhash`) + VALUES (:qid, :subject, :score, :sender, :rcpt, :symbols, :user, :ip, :msg, :action, :fuzzy_hashes, :qhash)"); $stmt->execute(array( ':qid' => $qid, ':subject' => $subject, @@ -229,11 +230,9 @@ foreach ($rcpt_final_mailboxes as $rcpt_final) { ':ip' => $ip, ':msg' => $raw_data, ':action' => $action, - ':fuzzy_hashes' => $fuzzy + ':fuzzy_hashes' => $fuzzy, + ':qhash' => bin2hex(random_bytes(32)) )); - $lastId = $pdo->lastInsertId(); - $stmt_update = $pdo->prepare("UPDATE `quarantine` SET `qhash` = SHA2(CONCAT(`id`, `qid`), 256) WHERE `id` = :id"); - $stmt_update->execute(array(':id' => $lastId)); $stmt = $pdo->prepare('DELETE FROM `quarantine` WHERE `rcpt` = :rcpt AND `id` NOT IN ( SELECT `id` FROM (