Sieve bug on duplicate extension with MessageID break line
Hello,
I noticed that sieve's duplicate function is not working when the MessageID header has a line break and I have encountered messages originating from Microsoft 365 this way.
For example:
# test 1
From: mailto:teste@domain.com.br teste@domain.com.br
To: mailto:cron@domain.com.br cron@domain.com.br
Subject: test
Message-Id: mailto:854115.209399851-sendEmail@pa1 854115.209399851-sendEmail@pa1
Date: Wed, 19 Jun 2024 12:35:16 -0300 (-03)
Test
# test 2
From: mailto:teste@domain.com.br teste@domain.com.br
To: mailto:cron@domain.com.br cron@domain.com.br
Subject: test
Message-ID:
mailto:854115.209399851-sendEmail@pa1 854115.209399851-sendEmail@pa1
Date: Wed, 19 Jun 2024 12:35:16 -0300 (-03)
test
# dovecot log
Jun 19 12:59:33 server1 dovecot[513090]: lmtp(cron@domain.com.br) mailto:cron@domain.com.br)%3c2993309%3e%3c4AeXHGUAc2adrC0AZCVTkw <2993309><4AeXHGUAc2adrC0AZCVTkw>: sieve: subject=test from:teste@domain.com.br sender:teste@domain.com.br to: cron@domain.com.br mailto:cron@domain.com.br size:1010 msgid=854115.209399851-sendEmail@pa1 mailto:854115.209399851-sendEmail@pa1 status=stored mail into mailbox 'INBOX' delivery_time=3 session_time=1
Jun 19 12:59:35 server1 dovecot[513090]: lmtp(cron@domain.com.br) mailto:cron@domain.com.br)%3c2993309%3e%3csKNOK2cAc2adrC0AZCVTkw <2993309><sKNOK2cAc2adrC0AZCVTkw>: sieve: subject=test from:teste@domain.com.br sender:teste@domain.com.br to: cron@domain.com.br mailto:cron@domain.com.br size:1014 msgid=854115.209399851-sendEmail@pa1 mailto:854115.209399851-sendEmail@pa1 status=stored mail into mailbox 'INBOX' delivery_time=3 session_time=1
# sieve rule
require ["duplicate", "fileinto", "envelope", "variables"];
if envelope :matches "from" "*" { set "sender" "${1}"; }
if header :matches "subject" "*" { set "subject" "${1}"; }
if header :matches "message-id" "*" {
if duplicate :seconds 300 :uniqueid "${sender} ${subject} ${0}"{
discard;
}
}
Regards,
Ricardo
participants (1)
-
ricardomachini@gmail.com