aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman
diff options
context:
space:
mode:
authorMark Sapiro <mark@msapiro.net>2009-08-01 12:14:32 -0700
committerMark Sapiro <mark@msapiro.net>2009-08-01 12:14:32 -0700
commit205504d8f729af4a948ad7a3c9636939dbdc00b9 (patch)
tree56aad0e9842aec4588c2af7aeaf050c467247450 /Mailman
parent510daed5ea265ba076c8850a670ec8de8ad50c56 (diff)
downloadmailman2-205504d8f729af4a948ad7a3c9636939dbdc00b9.tar.gz
mailman2-205504d8f729af4a948ad7a3c9636939dbdc00b9.tar.xz
mailman2-205504d8f729af4a948ad7a3c9636939dbdc00b9.zip
Removed or anonymized additional headers in posts to anonymous lists.
Diffstat (limited to '')
-rw-r--r--Mailman/Handlers/Cleanse.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/Mailman/Handlers/Cleanse.py b/Mailman/Handlers/Cleanse.py
index 8033d41f..b2c9611a 100644
--- a/Mailman/Handlers/Cleanse.py
+++ b/Mailman/Handlers/Cleanse.py
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2006 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2009 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -17,8 +17,11 @@
"""Cleanse certain headers from all messages."""
+import re
+
from email.Utils import formataddr
+from Mailman.Utils import unique_message_id
from Mailman.Logging.Syslog import syslog
from Mailman.Handlers.CookHeaders import uheader
@@ -39,11 +42,21 @@ def process(mlist, msg, msgdata):
del msg['from']
del msg['reply-to']
del msg['sender']
+ del msg['return-path']
# Hotmail sets this one
del msg['x-originating-email']
+ # And these can reveal the sender too
+ del msg['received']
+ # And so can the message-id so replace it.
+ del msg['message-id']
+ msg['Message-ID'] = unique_message_id(mlist)
i18ndesc = str(uheader(mlist, mlist.description, 'From'))
msg['From'] = formataddr((i18ndesc, mlist.GetListEmail()))
msg['Reply-To'] = mlist.GetListEmail()
+ uf = msg.get_unixfrom()
+ if uf:
+ uf = re.sub(r'\S*@\S*', mlist.GetListEmail(), uf)
+ msg.set_unixfrom(uf)
# Some headers can be used to fish for membership
del msg['return-receipt-to']
del msg['disposition-notification-to']