Extension:Antispam
Release status: stable |
|
|---|---|
| Implementation | User activity, Page action |
| Description | Invisible spam protection for account creation, edits and uploads by the cloud anti-spam service CleanTalk.org. No CAPTCHA for visitors. |
| Author(s) | CleanTalk Developers Team |
| Latest version | 2.5 (2026-07-10) |
| MediaWiki | 1.29+ |
| PHP | 7.4+ |
| Database changes | Yes |
|
|
|
|
|
|
| Licence | GNU General Public License 2.0 or later |
| Download | GitHub:
Note: https://cleantalk.org/help/install-mediawiki https://github.com/CleanTalk/mediawiki-antispam/releases |
| Version 2.5 tested with MediaWiki 1.43 (LTS) and PHP 8.2. | |
The Antispam extension protects a wiki from spam bots and manual spam without CAPTCHA. It is a client for the commercial cloud anti-spam service cleantalk.org. The extension checks new account registrations, edits, page moves and file uploads in the cloud and rejects the ones that come from spam bots or known spam senders. Visitors do not solve puzzles or tick boxes, the check is invisible.
Features
[edit]Anti-Spam service
The CleanTalk Cloud Service provides automatic and invisible protection from spam for websites. CleanTalk analyzes user behavior and evaluates the parameters of a completed form.
When installed on your website, the Anti-Spam Module captures the behavior parameters of a visitor or a spambot. These parameters are being assessed, and the service decides to post the visitor's message or to define it as spam and reject it. Based on such checks, the service forms its list of email addresses used by spambots. Likewise, visitor registrations are being checked too. The service adds not only email addresses to the global blacklist but also IP addresses and domains of the websites that are promoted through spam mailout.
What is checked
- Account creation (Special:CreateAccount): email address, username, IP address and the JavaScript test.
- Edits and new pages: page title, edit summary and text, together with the sender's reputation. Edits by users with more than
$wgCTMinEditCountedits and by users with thecleantalk-bypassright are not checked. - Page moves and file uploads.
- With Spam FireWall enabled, every HTTP request from an IP address in the CleanTalk blacklist of active spam bots.
No CAPTCHA
The check happens in the cloud, so there is no CAPTCHA, no image puzzle and no checkbox for visitors. If you already use Extension:ConfirmEdit, both extensions can run together. A blocked visitor sees the reason, for example "Forbidden. Sender blacklisted".
Spam Firewall feature
This option allows blocking spam bots before they access MediaWiki content. CleanTalk collects spam bots activity data on websites, and IP addresses of the most active spam bots are added to the Spam Firewall database. The service intercepts any HTTP(POST/GET) requests to a site and IP address it contains. If an IP address is included in the CleanTalk blacklist of most spam active IPs, it will get a special page; if it is a real visitor, then it proceeds to the site. That is completely transparent to the visitors. The results of Spam FireWall are logged and available in your control panel.
Real-Time Email Address Existence Validation
To validate that users sign up with their real email addresses, the CleanTalk server will perform email account existence checks using an SMTP response.
Private blacklist/whitelist
Automatically blocks comments and registrations from your private black IP/email address list. This option helps to strengthen the protection from manual spam or block unwanted user comments. You can add not only certain IP addresses but also a separate subnet to your blacklist. The extension allows blocking or whitelisting emails for registration using wildcards; for example, "*@mail.com" will block/allow every address ending on @mail.com.
Blocking users by country
The external service can be used to block comments and registrations from specific countries automatically.
Stoplist by words
Comments that contain specific words can be forbidden.
Screenshots
[edit]-
World map of top spam
-
Log contents
-
Account creation rejected
Installation
[edit]- Download, extract, and place the file(s) in a directory called
Antispamin yourextensions/folder. - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'Antispam' );
- Configure as required.
Done – Navigate to Special:Versionon your wiki to verify that the extension is successfully installed.
The extension needs an access key. Get it at cleantalk.org/register (free trial, no card) and put it into LocalSettings.php below the load line:
wfLoadExtension( 'Antispam' );
$wgCTAccessKey = 'your access key';
Do not edit extension.json or Antispam.php inside the extension folder: the next update overwrites them.
To verify the installation, open Special:CreateAccount and register with the email address stop_email@example.com.
The registration must be rejected with the message "Forbidden. Sender blacklisted".
Blocked and allowed requests are listed in the CleanTalk control panel.
Configuration
[edit]| Name | Default | Description |
|---|---|---|
$wgCTAccessKey
|
""
|
|
$wgCTNewEditsOnly
|
false
|
Check only new pages (true) or every edit (false).
|
$wgCTMinEditCount
|
10
|
Users with more edits than this value are not checked. Ignored when $wgCTNewEditsOnly is true.
|
$wgCTSFW
|
false
|
Enable Spam FireWall: block HTTP requests from IP addresses in the CleanTalk blacklist before MediaWiki runs. |
$wgCTCheckNoConnect
|
true
|
Reserved. Not used by version 2.5: when the cloud does not answer, the request passes if the visitor passed the JavaScript test. |
$wgCTShowLink
|
true
|
Show a small "protected by CleanTalk" link at the bottom of pages. |
$wgCTAdminAccountId
|
1
|
User ID that receives notifications from the extension (for example, when the access key expires). |
$wgCTAdminNotificaionInteval
|
10800
|
Minimum interval between admin notifications, in seconds. |
$wgCTServerURL
|
"https://moderate.cleantalk.org/api2.0"
|
Cloud API endpoint. Do not change. |
$wgCTAgent
|
"mediawiki-2.5.0"
|
Client name sent to the cloud. Do not change. |
$wgCTExtName
|
"Antispam by CleanTalk"
|
Name shown in block messages and notifications. |
Excluding trusted users
Give the cleantalk-bypass right to groups that should never be checked.
Administrators have it by default.
Bots and API clients do not pass the JavaScript test, so grant them the right as well:
$wgGroupPermissions['bot']['cleantalk-bypass'] = true;
$wgGroupPermissions['autoconfirmed']['cleantalk-bypass'] = true;
Frequently asked questions
[edit]Does the extension replace CAPTCHA?
Yes, for most wikis. The check is done in the cloud by the sender's reputation, behaviour and content, so visitors do not see a CAPTCHA. If you want to keep Extension:ConfirmEdit as a second line, both can be enabled.
Edits made through the API or by a bot are rejected with "Forbidden". Why?
Requests without a browser do not pass the JavaScript test and the cloud treats them as bots.
Grant the cleantalk-bypass right to the bot group (see Configuration) or raise the user's edit count above $wgCTMinEditCount.
Should I change anything in the extension's settings or in my CleanTalk Control Panel when I switch my website from HTTP to HTTPS or vice versa?
No, the extension will work regardless of the protocol.
After installation, on creation of a test user, I get error: Fatal exception of type "Wikimedia\Rdbms\DBQueryError". How to fix?
- Update the extension to version 2.5 or newer: the tables the extension needs are now created automatically.
- Don't set the key in the extensions/Antispam/Antispam.php file, but in LocalSettings.php file as variable $wgCTAccessKey below the load instruction.
This extension is dependent on cleantalk.org, a commercial paysite. Are there any free options or alternatives?
The Antispam extension is specific to this one provider, which is non-free. There are hundreds of other real-time blocklists (RBLs) or DNS blocklists (DNSBLs), both paid and free; most target spam e-mail but a few target forum or blog comment spam. Extension:StopForumSpam uses stopforumspam.com to prevent comment spam, for instance. Another option is to download IP deny lists from any of a number of sources, and import them into MediaWiki using the maintenance/updateDenyList.php script.
But what about false positives? Is there any way to prevent the extension from submitting the username, email address and IP address of my legit users only to have them appear on cleantalk.org's public blocklists?
While the number of false positives is relatively low, this is a problematic issue. It's best to mitigate this risk by only invoking Antispam on new account creation and on new page creation by new or anonymous users.
- Implement autoconfirmation and set $wgAutoConfirmAge to something reasonable. Give the 'cleantalk-bypass' permission to the bot, sysop and autoconfirmed groups by by setting $wgGroupPermissions['autoconfirmed']['cleantalk-bypass'] = true; and making the same change for other desired groups in LocalSettings.php.
- Limit the extension to new page creation by setting
$wgCTNewEditsOnly = true;in LocalSettings.php - The cleantalk.org web interface does provide a list of who and what has been blocked by the filter. It is possible to report false-positive or false-negative results there; this doesn't reinstate a wrongly-blocked edit or remove a wrongly-blocked IP from the Cleantalk lists, but it will temporarily whitelist the user on your own site.
I have multiple subprojects (such as en.example.wiki, fr.example.wiki, pt.example.wiki) for different topics or different languages. Will this extension work with this structure, or do I need to redesign the site to user www.example.wiki/en/PageName www.example.wiki/es/PageName and the like?
The extension will work regardless of your URL structure. The only limitation is that the Cleantalk server will remove the original domain and subdomain, replacing them with whatever domain name is tied to the ID specified in $wgCTAccessKey. This only affects the displayed blocklogs on the Cleantalk website; the extension will still work. Another option is to purchase multiple keys (one for each language subproject) but this does cost extra.
