The SpamFilter is a JSPWiki filter that can be used to block questionable edits. It is powered by "Herb", the JSPWiki spam engine.
Parameters#
- wordlist
- The name of the WikiPage on which the word list resides. Default is SpamFilterWordList.
- IPlist
- Page name where the IP regexps are found. Default is SpamFilterIPList.
- maxpagenamelength
- Maximum page name length. Default is 100.
- errorpage
- The name of the page to which the user is redirected, if the edit contains a matched word. On that page, the variable [{$msg}] is available, telling the reason.
- pagechangesinminute
- How many page changes are allowed per minute before the IP address is put on a temporary ban list. Default is 5 changes/minute.
- bantime
- The length of the ban time. Default is 60 for 60 minutes.
- maxurls
- How many URLs can an user add at once. Default is 5 URLs, before they are considered to be spammers. Internal Wiki links are not considered URLs. This feature is available since JSPWiki 2.4.72.
- akismet-apikey
- If you have an Akismet API key, just put it here and JSPWiki will start automatically using Akismet to do spam filtering. This feature is available since JSPWiki 2.4.72.
- similarchanges
- How many similar changes are allowed, regardless of which IP address they come from. Default is 2. This feature is available since JSPWiki 2.4.72.
- ignoreauthenticated
- If set to true, all authenticated users are ignored and never caught in SpamFilter. Default is false.
- jspwiki.filters.spamfilter.allowedgroups
- a comma separated list of groups that will bypass the filter. Available since JSPWiki 2.11.0.
The word list#
The SpamFilter looks at the WikiVariable called 'spamwords' on the wordlist page. This must contain a space-separated list of words not allowed in a page. In fact, each word is a full Perl5 regular expression, so you can do pretty complex matches as well.
Of course, it is a good idea to allow only trusted users to edit the wordlist page. Otherwise a spammer can remove the list...
Example#
Put the following in your filters.xml file (See PageFilter Configuration for more information):
<filter> <class>org.apache.wiki.filters.SpamFilter</class> </filter>
to start the filter. Create a page called "SpamFilterWordList" and put the following on it:
[{SET spamwords='viagra money'}]to prevent anyone from saving a page that contains either the word "viagra" or "money". In a bit more complicated example:
[{SET spamwords='[vV][iI][aA][gG][rR][aA]'}]would block the words "viagra", "Viagra", "viAGra" and so on.
Advanced example#
This is how you use parameters. Assume that your Akismet API key is "1234567890", you would like to extend the ban time to 2 hours (120 minutes), and would like to limit page changes per minute to value of 5 changes/minutes. You can tell it to the SpamFilter like this:
<filter> <class>org.apache.wiki.filters.SpamFilter</class> <param> <name>bantime</name> <value>120</value> </param> <param> <name>pagechangesinminute</name> <value>5</value> </param> <param> <name>akismet-apikey</name> <value>1234567890</value> </param> </filter>
Category.Documentation