One of the suggestions that came out of the [[todo/anti-spam_protection]] is to have the [MoinMoin technique](http://moinmo.in/HelpOnSpam) of having a list of [bad content](http://moinmo.in/BadContent) which is basically a list of regexes. Typically, you'd add a URL in there, but really, it's just any "bad content": it could be forbidden words or whatever.
This, by the way, only worked so far with MoinMoin. Spammers did find a way around it, and the list's last update dates back to 2014. But that doesn't mean the list is not at least somewhat effective. In my specific use case right now, I moderate all incoming comments and there's this one spammer which repeatedly tries to post the same stupid URL. I delete the comment and move on, but it's repetitive and frustrating: if I had a way to just block that one piece of bad content, it could make my life easier.
I think this could be a plugin, which hooks into the `checkcontent` hook [[joeyh]] made in the [[anti-spam_protection]] work. This todo is to track the work on writing such a plugin and, ultimately and hopefully, include it directly in ikiwiki.
I am not sure we should follow the MoinMoin mechanism, where the list is a wiki page, but why not? The only downside to this is that I'm not sure how to fetch content from an arbitrary page from inside a plugin. The other problem, of course, is that you then publish a list of bad URLs on your website, which is pretty much exactly the opposite of what you want to do... So maybe some file inside `.ikiwiki` or outside the published tree could be used.
Failing that, it could also simply be a list in the `ikiwiki.setup`. But my experience with managing a block list of IP addresses there has not been fun: you need to context switch (to another branch, or to the ikiwiki.setup file) and rebuild the wiki at each change, which is rather disruptive...
The "pie-in-the-sky" plugin here would of course to just plug the checkcontent hook straight into spamassassin or something similar. Then you possibly get bayesian filtering, all sorts of rules, Razor, etc.
> I looked into this briefly, and it seems like what I want (specifically: discard incoming comments if they have bad content) is fundamentally impossible with the current way the `checkcontent` hook is setup. When *pages* are inspected for content, yes, it's possible to just discard the submission, but not when *comments* are submitted, because the `IkiWiki::check_content` wrapper is called with `nonfatal => 1` which makes it skip any possible interception (returning a function or error message) that would abort submissions. This is because the comments module hardcodes the fact that a `checkcontent` failure is "soft" and means "this comment should be moderated"...
>
> So either a new hook needs to be written, or this one needs to be fixed, and either case it cannot be done simply with a plugin. I documented this odd behavior in [[plugins/write]]. --[[anarcat]]