MailmanWiki

4.82 How do I filter or scrub content before checking if a message is "too big"?

Mailman processes incoming messages through a pipeline of handlers which each do parts of the message processing. The default pipeline for all lists is defined in Defaults.py as the GLOBAL_PIPELINE list. It is possible to specify a different pipeline for a specific list by giving that list a 'pipeline' attribute. See 4.67. How do I implement a custom handler in Mailman? for information on doing this.

For purposes of this question, we note that within GLOBAL_PIPELINE we have the following handlers in this order:

 'Moderate'   process member moderation and non member actions
 'Hold'       process miscellaneous holds including max_message_size
 'MimeDel'    process content filtering
 'Scrubber'   scrub non text/plain parts to the archive if scrub_nondigest

If we just want to apply content filtering before checking max_message size (and the other miscellaneous holds) we can move MimeDel before Hold by putting the following in mm_cfg.py

GLOBAL_PIPELINE.remove('MimeDel')
GLOBAL_PIPELINE.insert(GLOBAL_PIPELINE.index('Hold'), 'MimeDel')

If we also want to scrub non text/plain parts before checking the miscellaneous holds, we can move Hold after Scrubber by putting the following in mm_cfg.py

GLOBAL_PIPELINE.remove('Hold')
GLOBAL_PIPELINE.insert(GLOBAL_PIPELINE.index('Scrubber') + 1, 'Hold')

Note that Scrubber must never come before MimeDel or parts that might have been removed by content filtering will instead be scrubbed to the archive if scrub_nondigest is Yes.

Also note that moving Scrubber before Hold will allow attachments of any size to be scrubbed to the archive before applying max_message_size. Whether or not this is desirable is an individual decision.

MailmanWiki: DOC/4.82 How do I filter or scrub content before checking if a message is "too big"? (last edited 2020-05-19 16:21:30 by msapiro)