From 9348a5dda1f912db4d043bcdedb4a72294c166cf Mon Sep 17 00:00:00 2001 From: Björn Persson Date: Aug 01 2020 20:59:03 +0000 Subject: Let's not process the email we send. According to the log message, this check is meant as a safeguard to prevent using Pagure's outgoing email as input. That must be done before any tests that can cause rejection. --- diff --git a/pagure-milters/comment_email_milter.py b/pagure-milters/comment_email_milter.py index 7c4bfa7..3627d70 100644 --- a/pagure-milters/comment_email_milter.py +++ b/pagure-milters/comment_email_milter.py @@ -151,6 +151,10 @@ class PagureMilter(Milter.Base): ) return Milter.CONTINUE + if msg["From"] and msg["From"] == _config.get("FROM_EMAIL"): + self.log("Let's not process the email we send") + return Milter.ACCEPT + msg_id = msg.get("In-Reply-To", None) if msg_id is None: self.log("No In-Reply-To, can't process this message.") @@ -201,11 +205,6 @@ class PagureMilter(Milter.Base): session.remove() return Milter.REJECT - if msg["From"] and msg["From"] == _config.get("FROM_EMAIL"): - self.log("Let's not process the email we send") - session.remove() - return Milter.REJECT - msg_id = clean_item(msg_id) if msg_id and "-ticket-" in msg_id: