]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Update HTML fuzzy encryption to use helper functions
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sun, 5 Oct 2025 15:36:23 +0000 (16:36 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sun, 5 Oct 2025 15:36:23 +0000 (16:36 +0100)
The fuzzy_cmd_from_html_part() function was using legacy encryption logic
that only checked rule->peer_key. Updated to use fuzzy_rule_has_encryption()
and fuzzy_select_encryption_keys() helpers for consistency with other fuzzy
command functions and to support separate read/write encryption keys.

src/plugins/fuzzy_check.c

index 4d24f71821396587a00b8214fa8d497426dda6b2..395fc2512a4fa6e7e0d0132a0b925f361bffa0c5 100644 (file)
@@ -2383,10 +2383,15 @@ fuzzy_cmd_from_html_part(struct rspamd_task *task,
        io->flags = FUZZY_CMD_FLAG_HTML;
        memcpy(&io->cmd, &shcmd->basic, sizeof(io->cmd));
 
-       if (rule->peer_key) {
+       if (fuzzy_rule_has_encryption(rule)) {
+               struct rspamd_cryptobox_keypair *local_key;
+               struct rspamd_cryptobox_pubkey *peer_key;
+
+               fuzzy_select_encryption_keys(rule, c, &local_key, &peer_key);
+
                /* Encrypt data */
                fuzzy_encrypt_cmd(rule, &encshcmd->hdr, (unsigned char *) shcmd,
-                                                 sizeof(*shcmd) + additional_length);
+                                                 sizeof(*shcmd) + additional_length, local_key, peer_key);
                io->io.iov_base = encshcmd;
                io->io.iov_len = sizeof(*encshcmd) + additional_length;
        }