Akismet: Spam Protection for MODX

Related tags

Security Akismet
Overview

Akismet: Spam Protection for MODX

Developed by modmore

Introduction

Akismet is an advanced spam protection service that uses AI to analyse form submissions. It learns from spam patterns around the web in real-time, and is extremely effective at blocking spam without hindering the user experience with CAPTCHAs.

Originally developed for Wordpress, this open source package integrates Akismet with the MODX extras FormIt, Login (specifically the Register snippet), and Quip.

The provided MODX snippet Akismet is used as a hook with FormIt, and a preHook with Register and Quip. Note that hooks for Quip are not documented, but you can add &preHooks to the QuipReply snippet.

Akismet is free for personal sites or blogs, and requires a paid subscription for use on commercial websites. Learn more about Akismet's subscription model.

Installation

Install Akismet via the modmore package provider. Sign up for an Akismet account here, then copy and paste the provided API Key into the new akismet.api_key system setting.

Usage with FormIt

Within your FormIt snippet call, add Akismet as one of your hooks. Preferably the first one, as to prevent other hooks running if spam is detected.

[[!FormIt? 
    &hooks=`Akismet,email,redirect`
    ...
]]

Usage with Login

Within your Register snippet call, add Akismet as one of your preHooks.

[[!Register?
    &preHooks=`Akismet`
    ...
]]

Usage with Quip

Within your QuipReply snippet call, add Akismet as one of your preHooks.

[[!QuipReply?
    &preHooks=`Akismet`
    ...
]]

Configurable Fields

Since Akismet was originally developed for Wordpress, it accepts fields that are related to comments on blog posts, such as comment_author, comment_author_email and comment_content.

MODX allows any naming convention for fields, so you set the field names you're using as snippet parameters. This works with FormIt, Register and Quip.

Say for example, you have a contact form with the following fields: name, email and message. You can set these to the fields that the Akismet service is expecting. See this code example:

[[!FormIt? 
    &hooks=`Akismet,email,redirect`
    &akismetAuthor=`name`
    &akismetAuthorEmail=`email`
    &akismetContent=`message`
    
    &akismetTest=`1`
    &akismetType=`contact-form`
    &akismetHoneypotField=`nospam`
    ...
]]

Complete List of Parameters

  • &akismetAuthor - The author's name.
  • &akismetAuthorEmail - The author's email.
  • &akismetAuthorUrl - The author's URL if they provided one.
  • &akismetContent - The message content.
  • &akismetType - The type of form submitted. Available types include comment, forum-post, reply, blog-post, contact-form, signup, message, and more. Read more here.
  • &akismetUserRole - The type of user e.g. visitor, or member. If set to Administrator, the form will never be blocked.
  • &akismetTest - Set this to 1 while developing so the AI knows it is just a test submission.
  • &akismetHoneypotField - If you use a hidden honeypot field in your form, set the name of it here.
  • &akismetRecheckReason - If you have a form where the same submission needs to be checked more than once, include the reason for it here.
  • &akismetError - The error message to set when the form failed the spam check. By default, this will use the akismet.message_blocked lexicon, which you may edit via System > Lexicon Management > akismet (select in the namespace dropdown), or you can provide the snippet property with a different message entirely.

Combining Fields

Perhaps your web form has separate fields for a persons first name and last name. Many do! Akismet expects a single author field however, so from v1.1 onwards, you can combine fields by adding the field names together separated by commas.

For example:

&akismetAuthor=`first_name,last_name`
&akismetContent=`main_content_field,another_content_field`

Automatic Cleanup

By default, Akismet will remove spam checks that are more than 30 days old. This period can be adjusted with the akismet.cleanup_days_old system setting.

To disable automatic cleanup, set akismet.cleanup_days_old to 0.

The cleanup does not require a cron job. It stores a timestamp in core/components/akismet/.cleanup and reads that every time a spam check is performed. If it's been more than the configured days since a cleanup happened, it will remove old checks right at that time.

Comments
  • Support for Quip?

    Support for Quip?

    To my surprise, it appears QuipReply also runs preHooks. So maybe we could also add support for that in a future release - I've got Quip setup on my personal site if a test bed is needed. Not that there's a lot of posts going on there, but..

    Code of quipHooks looks virtually identical to that of loginHooks so maaaaaaaaybe we just need to check for it in Akismet::getFields/setError?

    opened by Mark-H 4
  • Whitelist grid on the CMP

    Whitelist grid on the CMP

    It might be useful to be able to whitelist certain fields/values (e.g. email) via a second grid on the Akismet manager page.

    This way, if Akismet is used on a sign-up form, and there is a false positive which the user reports, their email could be added to the whitelist (in addition to sending the submit ham request).

    The whitelist check could be performed at the beginning of the checkSpam() method, returning early if on the whitelist.

    opened by muzzwood 1
  • Refactor Akismet class to allow easier standalone use

    Refactor Akismet class to allow easier standalone use

    https://modmore.com/blog/2021/new-akismet-for-modx/#comment-5526800126

    Perhaps changing the Akismet class from:

        public function checkSpam($hook): bool
    

    to

        public function checkSpam(array $values, array $config): bool
    

    so that the snippet is responsible for getting the values and setting the error would be easiest to adapt?

    Alternatively, pass those values into the constructor.

    opened by Mark-H 1
  • Automatically remove forms after a certain period

    Automatically remove forms after a certain period

    Similar to Scheduler/FormIt, have a way to automatically remove submissions older than a certain amount of time.

    Perhaps a cron-less solution could be to have the Akismet::checkSpam() method run the cleanup once a day based on a timestamp in a dot-file.

    opened by Mark-H 1
  • Honeypot field implementation not correct?

    Honeypot field implementation not correct?

    From the docs:

    honeypot_field_name If you use a honeypot field in your implementation, include the name of the field in your request as well as the value of that field. For example, if you have a honeypot field that looks like , then you should include two extra parameters in your request: honeypot_field_name=hidden_honeypot_field and hidden_honeypot_field=[the value of the input].

    Looks like right now it just sends the value of the field in a different name entirely:

                'honeypot_field' => $fields['akismetHoneypotField'] ?? '',
    

    Perhaps you got that from elsewhere @muzzwood?

    opened by Mark-H 1
  • Support for proxies when getting user IP

    Support for proxies when getting user IP

    Currently uses $_SERVER['REMOTE_ADDR'] which may contain the IP of a proxy like Cloudflare; that should be extended to use the X-Forwarded-For header and such.

    opened by Mark-H 0
  • For signup spam, allow forward to fake success page

    For signup spam, allow forward to fake success page

    It would be nice if the extra had an option to forward spammers to a fake page with something like "Thanks for Registering", or something equally appropriate, so they would have no clue that the registration was not successful and wouldn't alter their submissions.

    opened by BobRay 0
  • Possible support for AjaxForm

    Possible support for AjaxForm

    I haven't looked into the specifics yet, but AjaxForm also has hooks. It might be possible to add support for it to Akismet. https://github.com/modx-pro/AjaxForm

    opened by muzzwood 1
Owner
modmore | More for MODX
modmore | More for MODX
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.

Themis provides strong, usable cryptography for busy people General purpose cryptographic library for storage and messaging for iOS (Swift, Obj-C), An

Cossack Labs 1.6k Jan 6, 2023
㊙️ AntiXSS | Protection against Cross-site scripting (XSS) via PHP

㊙️ AntiXSS "Cross-site scripting (XSS) is a type of computer security vulnerability typically found in Web applications. XSS enables attackers to inje

Lars Moelleken 570 Dec 16, 2022
JObfuscator — Java Source Code Obfuscation & Protection

JObfuscator is a source code obfuscator for the Java programming language. It can protect your Java source code and algorithms from hacking, cracking, reverse engineering, decompilation, and technology theft.

Bartosz Wójcik 8 Nov 6, 2022
SyCaptchaBundle is a form protection bundle made for Symfony, including a set of CAPTCHA challenges that should stop any malicious requests from submitting your forms.

SyCaptchaBundle is a form protection bundle made for Symfony, including a set of CAPTCHA challenges that should stop any malicious requests from submitting your forms.

Matt 1 Oct 4, 2022
SPAM Registration Stopper is a Q2A plugin that prevents highly probable SPAM user registrations based on well-known SPAM checking services and other techniques

SPAM Registration Stopper [by Gabriel Zanetti] Description SPAM Registration Stopper is a Question2Answer plugin that prevents highly probable SPAM us

Gabriel Zanetti 2 Jan 23, 2022
Rah comment spam - Comment anti-spam plugin for Textpattern CMS

rah_comment_spam Packagist | Issues | Donate Rah_comment_spam provides customizable anti-spam tools for Textpattern CMS’ comment system. Set minimum a

Jukka Svahn 2 Apr 24, 2022
Adds a "spam protection" field to SilverStripe userforms using Cloudflare's Turnstile service.

Turnstile for Silverstripe Adds a "spam protection" field to SilverStripe userforms using Cloudflare's Turnstile service. Maintainer Contact Ed Chipma

Webbuilders Group 3 Dec 15, 2022
Akismet for Laravel 6.x/7.x/8.x

Laravel Akismet Installation Install this package with composer: composer require nickurt/laravel-akismet Copy the config files for the api php artis

Nick 85 Nov 20, 2022
PHP CLI tool which allows publishing zipped MODX extra to modstore.pro marketplace

MODX Extra Publisher PHP CLI tool which allows publishing zipped MODX extra to modstore.pro marketplace. Installation global? local? To install packag

Ivan Klimchuk 3 Aug 6, 2021
MODX Helper for Tailwind

TailwindHelper MODX Helper for Tailwind Features This MODX Extra adds a Tailwind helper to the MODX installation: Write a safelist.json on base on chu

Thomas Jakobi 3 Jan 10, 2022
All In 1 Spam Tool For Termux Users Subscribe Us (Noob Hackers) some shit heads are trying to abuse this script so don't worry about them ...let them hallucinate ...but you are free to use this script

ABOUT TOOL : SPAMX is a all in one Bombing+Spam tool from this tool you can send anonymous messages to your target without showing your real number an

N17R0 449 Jan 7, 2023
PHP client library for reCAPTCHA, a free service to protect your website from spam and abuse.

reCAPTCHA PHP client library reCAPTCHA is a free CAPTCHA service that protects websites from spam and abuse. This is a PHP library that wraps up the s

Google 3.3k Dec 23, 2022
Friendly Captcha anti-spam plugin for Joomla!

Friendly Captcha anti-spam plugin for Joomla! Register at https://friendlycaptcha.com to get your site and secret keys. Plugin Features Standard light

null 10 Dec 14, 2022
Honeypot spam prevention for Laravel applications

Honeypot spam prevention for Laravel applications How does it work? "Honeypot" method of spam prevention is a simple and effective way to defer some o

Maksim Surguy 420 Jan 1, 2023
WPBruiser {no- Captcha anti-Spam} (forked, updated)

=== WPBruiser {no- Captcha anti-Spam} === Contributors: mihche, knutsp Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_

Webfacing 2 Jul 26, 2022
Cloudflare Turnstile anti-spam plugin for Joomla!

Cloudflare Turnstile anti-spam plugin for Joomla! Turnstile is Cloudflare's smart CAPTCHA alternative. It can be embedded into any website without sen

null 2 Nov 10, 2022
Packet-driven global form interaction-spam blocker for PM.

Looking for testers and README improvers! Form Interaction Fix Interaction-spam Interaction spam is often a problem for players who use the mouse as t

EndermanbugZJFC 5 Dec 16, 2022
PHP cache library, with adapters for e.g. Memcached, Redis, Couchbase, APC(u), SQL and additional capabilities (e.g. transactions, stampede protection) built on top.

Donate/Support: Documentation: https://www.scrapbook.cash - API reference: https://docs.scrapbook.cash Table of contents Installation & usage Adapters

Matthias Mullie 295 Nov 28, 2022
An alternative Redis session handler for PHP featuring per-session locking and session fixation protection

RedisSessionHandler An alternative Redis session handler featuring session locking and session fixation protection. News phpredis v4.1.0 (released on

Marcel Hernandez 117 Oct 19, 2022