Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
b035d936 by Mark Sapiro at 2022-09-17T17:44:44+00:00
Don't remove non X- headers regardless of anonymous_list_keep_headers.

Closes #1031

- - - - -
2f090dff by Mark Sapiro at 2022-09-17T17:44:44+00:00
Merge branch 'anon' into 'master'

Don't remove non X- headers regardless of anonymous_list_keep_headers.

Closes #1031

See merge request mailman/mailman!1038
- - - - -


5 changed files:

- src/mailman/config/schema.cfg
- src/mailman/docs/NEWS.rst
- src/mailman/handlers/cleanse.py
- src/mailman/rest/docs/systemconf.rst
- src/mailman/rest/tests/test_systemconf.py


Changes:

=====================================
src/mailman/config/schema.cfg
=====================================
@@ -47,11 +47,13 @@ sender_headers: from from_ reply-to sender
 # This is a space separated list of regexps which match headers to be kept
 # in messages to anonymous lists.  Many headers are removed from posts to
 # anonymous lists before this is consulted, but of the remaining headers,
-# any that don't match one of these patterns are also removed.  The headers
-# kept by default are non X- headers, those X- headers added by Mailman
-# and any X-Spam- headers.  The match is case-insensitive.
-anonymous_list_keep_headers: ^(?!x-) ^x-mailman- ^x-content-filtered-by:
- ^x-topics: ^x-ack: ^x-beenthere: ^x-list-administrivia: ^x-spam-
+# any X-* headers that don't match one of these patterns are also removed.
+# The X-* headers kept by default are those X-* headers added by Mailman
+# and any X-Spam- headers.  The match is case-insensitive.  This does not
+# affect non X-* headers, those of which might identify senders or their
+# domains are deleted or replaced.
+anonymous_list_keep_headers: ^x-mailman- ^x-content-filtered-by: ^x-topics:
+ ^x-ack: ^x-beenthere: ^x-list-administrivia: ^x-spam-
 
 # Mail command processor will ignore mail command lines after designated max.
 email_commands_max_lines: 10


=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -69,6 +69,8 @@ Bugs fixed
   parts of folded subject headers.  (Closes #1021)
 * The ``verp_confirmations`` setting has now been implemented with default
   of ``yes``.  (Closes #1023)
+* The ``anonymous_list_keep_headers`` setting now only applies to X-* headers
+  and will not cause non X-* headers to be removed.  (Closes #1031)
 
 REST
 ====


=====================================
src/mailman/handlers/cleanse.py
=====================================
@@ -53,6 +53,9 @@ class Cleanse:
                     'Ignored bad anonymous_list_keep_headers regexp %s: %s',
                     regexp, e)
         for hdr in msg.keys():
+            # Only remove X- headers here.
+            if not hdr.lower().startswith('x-'):
+                continue
             keep = False
             for cre in cres:
                 if cre.search(hdr):


=====================================
src/mailman/rest/docs/systemconf.rst
=====================================
@@ -15,8 +15,8 @@ You can also get all the values for a particular section, 
such as the
 ``[mailman]`` section...
 
     >>> dump_json('http://localhost:9001/3.0/system/configuration/mailman')
-    anonymous_list_keep_headers: ^(?!x-) ^x-mailman- ^x-content-filtered-by:
-    ^x-topics: ^x-ack: ^x-beenthere: ^x-list-administrivia: ^x-spam-
+    anonymous_list_keep_headers: ^x-mailman- ^x-content-filtered-by: ^x-topics:
+    ^x-ack: ^x-beenthere: ^x-list-administrivia: ^x-spam-
     cache_life: 7d
     check_max_size_on_filtered_message: no
     default_language: en


=====================================
src/mailman/rest/tests/test_systemconf.py
=====================================
@@ -37,9 +37,8 @@ class TestSystemConfiguration(unittest.TestCase):
         self.assertIn('http_etag', json)
         del json['http_etag']
         self.assertEqual(json, dict(
-            anonymous_list_keep_headers='^(?!x-) ^x-mailman- '
-                                        '^x-content-filtered-by:\n'
-                                        '^x-topics: ^x-ack: ^x-beenthere: '
+            anonymous_list_keep_headers='^x-mailman- ^x-content-filtered-by: '
+                                        '^x-topics:\n^x-ack: ^x-beenthere: '
                                         '^x-list-administrivia: ^x-spam-',
             cache_life='7d',
             check_max_size_on_filtered_message='no',



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/49a6bd67980e84a15db369d10f20ac39c4c1f3b7...2f090dff28dae382ce502a11a92e1751c3ca3d93

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/49a6bd67980e84a15db369d10f20ac39c4c1f3b7...2f090dff28dae382ce502a11a92e1751c3ca3d93
You're receiving this email because of your account on gitlab.com.


_______________________________________________
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org

Reply via email to