Mercurial > p > roundup > code
diff doc/customizing.txt @ 3830:a48c514c465f
Add simple anti-spam recipe to docs
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Sun, 25 Mar 2007 23:18:25 +0000 |
| parents | e5043875a03d |
| children | 6d14a3b4e295 |
line wrap: on
line diff
--- a/doc/customizing.txt Thu Mar 22 02:49:50 2007 +0000 +++ b/doc/customizing.txt Sun Mar 25 23:18:25 2007 +0000 @@ -2,7 +2,7 @@ Customising Roundup =================== -:Version: $Revision: 1.217 $ +:Version: $Revision: 1.218 $ .. This document borrows from the ZopeBook section on ZPT. The original is at: http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx @@ -3834,6 +3834,37 @@ Changes to Tracker Behaviour ---------------------------- +Preventing SPAM +~~~~~~~~~~~~~~~ + +The following detector code may be installed in your tracker's +``detectors`` directory. It will block any messages being created that +have HTML attachments (a very common vector for spam and phishing) +and any messages that have more than 2 HTTP URLs in them. Just copy +the following into ``detectors/anti_spam.py`` in your tracker:: + + from roundup.exceptions import Reject + + def reject_html(db, cl, nodeid, newvalues): + if newvalues['type'] == 'text/html': + raise Reject, 'not allowed' + + def reject_manylinks(db, cl, nodeid, newvalues): + content = newvalues['content'] + if content.count('http://') > 2: + raise Reject, 'not allowed' + + def init(db): + db.file.audit('create', reject_html) + db.msg.audit('create', reject_manylinks) + +You may also wish to block image attachments if your tracker does not +need that ability:: + + if newvalues['type'].startswith('image/'): + raise Reject, 'not allowed' + + Stop "nosy" messages going to people on vacation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
