Jump to content

Estensioni:ConfirmEdit

From mediawiki.org
This page is a translated version of the page Extension:ConfirmEdit and the translation is 29% complete.
This extension comes with MediaWiki 1.18 and above. Thus you do not have to download it again. However, you still need to follow the other instructions provided.
Manuali di l'estenzioni MediaWiki
ConfirmEdit
Statu dâ rilassu: stàbbili
Implementation Page action
Description Aggiungi CAPTCHA pî sarbamenti dî pàggini e autri azzioni di l'utenti
Author(s)
  • Brooke Vibber
  • Florian Schmidt
  • Sam Reed
Latest version 1.6.0 (Aggiornamenti cuntinui)
Compatibility policy Snapshots releases along with MediaWiki. Master is not backward compatible.
MediaWiki >= 1.43
License GNU General Public License 2.0 or later
Download
  • $wgAllowConfirmedEmail
  • $wgCaptchaBadLoginExpiration
  • $wgCaptchaTriggersOnNamespace
  • $wgCaptchaStorageClass
  • $wgConfirmEditEnabledAbuseFilterCustomActions
  • $wgCaptchaSessionExpiration
  • $wgCaptchaRegexes
  • $wgCaptchaWhitelistIP
  • $wgCaptchaWhitelist
  • $wgCaptchaTriggers
  • $wgCaptchaBadLoginPerUserAttempts
  • $wgCaptchaBadLoginPerUserExpiration
  • $wgCaptcha
  • $wgCaptchaBadLoginAttempts
  • skipcaptcha
Quarterly downloads 183 (Ranked 35th)
Public wikis using 957 (Ranked 278th)
Translate the ConfirmEdit extension if it is available at translatewiki.net
Vagrant role confirmedit
Issues Open tasks · Report a bug

L'estinzioni ConfirmEdit pirmetti di usari diversi tècnichi CAPTCHA, pi pruvari a mpidiri spambots e autri strumenti autumatizzati di mudificari la tò wiki, accussì comu pi frustari li tintativi di login autumatizzati ca pruva a 'ndovinari li password.

ConfirmEdit navi cu diversi tecniche/moduli di generari captcha.

Modulu Discrizzioni Efficacia nnâ firmata dû spam
SimpleCaptcha L'utenti ànnu a arrisòrbiri un prubblema matimàticu sìmplici. Vasciu
FancyCaptcha L'utenti hannu a idintificari na seri di carattari, mustrati nta na manera stilizzata. Vasciu
MathCaptcha L'utenti ànnu a arrisòrbiri un prubblema matimàticu ca veni mustratu comu n'immaggini. Vasciu
QuestyCaptcha L'utenti hannu a rispùnniri a na dumanna, supra na para di dumanni difinuti di l'amministraturi. Àutu assai, nzinu a craccari
ReCaptcha NoCaptcha Li utenti hannu nu cuntrollu di l’umanità basatu supra JavaScript. Si lu cuntrollu nun arrinesci, veni prisintatu nu puzzle. Mediu a vasciu
hCaptcha Simili a reCAPTCHA, ma è prubbabbirmenti cchiù efficaci di reCAPTCHA pi lu so approcciu diversu ê captcha facilmenti accissìbbili. Scògnitu
Turnstile Cloudflare Turnstile. Rilevaturi di bot umanu senza azzioni (o sulu cliccannu nnâ casella). Scògnitu

Quarchi d'unu di sti moduli abbisogna di travagghi di cunfigurazzioni aggiuntivi:

  • MathCaptcha abbisogna sia dâ prisenza di TeX ca, pî virsiuna di MediaWiki doppu 1.17, l'estinzioni di Math ;
  • FancyCaptcha abbisogna di eseguiri nu script di cunfigurazzioni priliminari pi Python.

Svantaggi

Li CAPTCHA arridùciunu l'accissibbilità e causanu disaggiu a l'utenti umani.

Nun sunnu macari efficaci ô 100% contra li bot e nun prutègginu li tò wiki dî spammer ca sunnu disposti e capaci di usari lu travagghiu umanu pi attravirsari li CAPTCHA. Putissi usari CunfirmariMudifica nzèmmula cu autri funziunalità anti-spam. A priscìnniri dâ suluzzioni ca usa, si hai nu wiki pubbricamenti mudificabbili è mpurtanti cuntinuari a cuntrullari la pàggina "Canciamenti ricenti".

Nstallazzioni

ConfirmEdit putissi nun funziunari si usata cu na virsioni di MediaWiki diversa di chiḍḍa spicificata quannu si scarica attraversu lu "Distribbuturi di l'estensioni".
  • Download and move the extracted ConfirmEdit folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'ConfirmEdit' );
    
  • Attiva lu tipu CAPTCHA chi s'havi a usari
  • Cunfigura comu serbi
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.


Vagrant installation:

  • If using Vagrant , install with vagrant roles enable confirmedit --provision

Tipi di CAPTCHA

Ci su' assai tipi di CAPTCHA nchiusi cu ConfirmEdit.

QuestyCaptcha

Chistu modulu prisenta na dumanna e l'utenti duna la risposta. Furnisci li dumanni nnâ cunfigurazzioni. Stu modulu si dimustrò di òffriri nu miccanìsimu forti contra li spambot; avissi macari aviri lu vantaggiu di na megghiu accissibbilità, picchì li dumanni di testu ponnu èssiri liggiuti di nu software di testu-a-discursu ca pirmetti a l'utenti cu difficultà visivi (ma non ê bot) di rispùnniri currettamenti.

Aggiungi chistu a LocalSettings.php pi attivari stu CAPTCHA, mudificannu li Q&A:

wfLoadExtensions([ 'ConfirmEdit', 'ConfirmEdit/QuestyCaptcha' ]);

// Aggiungi li tò dumanni 'n LocalSettings.php usannu stu furmatu:
$wgCaptchaQuestions = [
	'What is the capital of France?' => 'Paris',
	'What is the capital of Spain' => 'MADRID', // Li risposti nun sunnu sinsìbbili ê maiusculi
	'What is the name of this wiki?' => $wgSitename, // Pudete usari variàbbili
	'How many fingers does a hand have?' => [ 5, 'five' ], // Na dumanna pò aviri tanti risposti
];

Scegli a casu 'na dumanna ri chiḍḍi furniti.

Lu minimu è unu.

  • QuestyCaptcha nun cunsidira li maiusculi. Si la risposta è "Paris" e l'utenti scrivi "paris", o si la risposta è "paris" e l'utenti scrivi "Paris", funziona ancora.
  • Si la risposta havi nu carattari spiciali comu "ó", si po scriviri na risposta cu "ó" e n'autra cu "o" (unni "o" scancia "ó"), sulu ntô casu. P'asempru, si la risposta è "canción" si po usari [ 'cancion', 'canción' ] 'n casu ca l'utenti scrivi "cancion".
  • La risposta havi a èssiri fàcili di 'ndovinari pi n'omu 'ntirissatu â tò wiki, ma nun cu nu prugramma autumàticu. Idealmenti, nun avissi a èssiri cuntinutu nnô testu dâ dumanna; si po pruvari e mudificari li messaggi d'aiutu dû captcha e dari la suluzzioni â risposta dû captcha ddòcu.[1]
  • Basta canciari li dumanni quannu/si accuminciunu a rivelàrisi inefficaci; chistu putissi nun succèdiri mai si la tò wiki nun è spicìficamenti mirata.
  • Don't ever reuse questions already used by you or others in the past: spambots are known to remember a question and its answer forever once they break it.
  • You can even dynamically generate questy captchas in the configuration. DO NOT use an exact copy of the dynamic questions from the link. Spammers have cracked them. However, other dynamic questions are highly effective in the style of the questions presented.
  • There is a separate extension to ConfirmEdit called QuestyCaptchaEditor which provides an on-wiki special page for managing QuestyCaptcha question+answer(s) pairings. You may wish to consider installing it if it's desirable to reduce sysadmin intervention when it comes to managing the CAPTCHA questions and their answers.

ReCaptcha (NoCaptcha)

Warning Warning: ReCaptcha has been cracked by most spambots targeting wikis, mainly due to its accessible captcha alternative.

The new generation of ReCaptcha, called NoCaptcha, was introduced by Google back in December 2014 and reduces the need for humans to solve a CAPTCHA.[2] Based on a user-side JavaScript (which can't be controlled by the user, the administrator), reCaptcha tries to identify the site user as a human by analyzing their browsing behavior on the page. The user then has to click an "I'm not a robot" checkbox and (in the best case) doesn't have to do anything further to prove they're a human. In some cases, the user still has to solve a CAPTCHA image.

ReCaptcha will not work with the Mobile Source Editor and some extensions.

This module implements the new ReCaptcha NoCaptcha solution in ConfirmEdit.

You still need a public and a secret key (which you can retrieve from the ReCaptcha admin panel – change v2, v3 not work) and install the plugin with:

wfLoadExtensions([ 'ConfirmEdit', 'ConfirmEdit/ReCaptchaNoCaptcha' ]);
$wgReCaptchaSiteKey = 'your public/site key here';
$wgReCaptchaSecretKey = 'your private key here';

There is an additional configuration option for this module, $wgReCaptchaSendRemoteIP (default: false), which, if set to true, sends the IP address of the current user to a server from Google while verifying the CAPTCHA. You can improve the privacy for your users if you keep this set to false. However, remember that this module adds a client-side JavaScript code, directly loaded from a server from Google, which already can collect the IP address of the user (combined with other data, too) and can not be limited by a configuration option. This will only work on the standard MediaWiki editor.

reCAPTCHA v3

Currently, there is no official way to implement version 3 of Google reCAPTCHA.

SimpleCaptcha (calculation)

Warning Warning: This type is used by very few wikis, if any, probably because of scarce effectiveness.
A simple math question

This is the default CAPTCHA.

This module provides a simple addition or subtraction question for the user.

Add the following lines to LocalSettings.php in the root of your MediaWiki to enable this CAPTCHA:

$wgCaptchaClass = 'SimpleCaptcha';

Note that the display of a trivial maths problem as plaintext yields a captcha which can be trivially solved by automated means; as of 2012, sites using SimpleCaptcha are receiving significant amounts of spam and many automated registrations of spurious new accounts. Wikis currently using this as the default should therefore migrate to one of the other CAPTCHAs.

FancyCaptcha

Warning Warning: This type is used by very few wikis outside WMF, if any, probably because of scarce effectiveness.

This module displays a stylized image of a set of characters.

Pillow must be installed to create the set of images initially, but isn't needed after that (can be installed with pip install Pillow in most environments).

  1. Add the following lines to LocalSettings.php in the root of your MediaWiki installation:
    wfLoadExtensions([ 'ConfirmEdit', 'ConfirmEdit/FancyCaptcha' ]);
    $wgCaptchaClass = 'FancyCaptcha';
  2. In LocalSettings.php, set the variable $wgCaptchaDirectory to the directory where you will store Captcha images. Note: use the absolute directory path or relative to your wiki's installation directory Below it set $wgCaptchaSecret to your passphrase.
  3. Create the images by running the following:
    python /path/to/captcha.py --font=<font> --wordlist=<wordlist> --key=<key> --output=<output> --count=<count>
    • where font is a path to some font, for instance AriBlk.TTF.
    • wordlist is a path to some word list, for instance /usr/share/dict/words. (Note: on Debian/Ubuntu, the 'wbritish' and 'wamerican' packages provide such lists. On Fedora, use the 'words' package)
    • key is the exact passphrase you set $wgCaptchaSecret to. Use quotes if necessary.
    • output is the path to where the images should be stored (defined in $wgCaptchaDirectory).
    • count is how many images to generate.
    • An example, assuming you're in the extensions/ConfirmEdit directory (font location from Ubuntu 6.06, probably different on other operating systems):
    python captcha.py --font=/usr/share/fonts/truetype/freefont/FreeSans.ttf --wordlist=/usr/share/dict/words --key=FOO --output=../../../captcha --count=100
    • If you are not satisfied with the results of the words you've generated, you can remove the images and create a new set. Comic_Sans_MS_Bold.ttf seems to generate relatively legible words, and you could also edit the last line of captcha.py to increase the font size from the default of 40.
  4. Put the images you get into captcha directory in your installation.
  5. Edit your wiki's LocalSettings.php : specify the full path to your captcha directory in $wgCaptchaDirectory and secret key you've been using while generating captures in $wgCaptchaSecret.
$wgCaptchaDirectory = "/.php-data/my-wiki.org/wiki/captcha";
$wgCaptchaDirectoryLevels = 0; // Set this to a value greater than zero to break the images into subdirectories
$wgCaptchaSecret = "FOO"; // Same value you used in --key option in captcha.py

See also wikitech:Generating CAPTCHAs for how the Wikimedia Foundation does it.

How to avoid common problems running Python on Windows
  1. Install the most recent version of Pillow.
  2. Make the installation of Python on a short folder name, like C:\Python\
  3. Create a folder like C:\Ex and place files CAPTCHA.py / FONT.ttf / LIST.txt into the folder.
  4. To execute easily, run the following example as a batch file:
C:\python\python.exe C:\Ex\CAPTCHA.py --font C:\Ex\FONT.ttf --wordlist C:\Ex\LIST.txt --key=YOURPASSWORD --output C:\Ex\ --count=20

MathCaptcha

MediaWiki version:
1.39
Warning Warning: This type is used by very few wikis, if any, probably because of scarce effectiveness.
This requires the Math extension to be installed. Also, since this requires the PNG mode of the Math extension, it no longer works since MediaWiki 1.40.

This module generates an image using TeX to ask a basic math question.

Set the following to enable this CAPTCHA:

wfLoadExtensions([ 'ConfirmEdit', 'ConfirmEdit/MathCaptcha' ]);

See the README file in the math folder to install this captcha.

hCaptcha

MediaWiki version:
1.35

The configuration is similar to ReCaptcha:

wfLoadExtensions([ 'ConfirmEdit', 'ConfirmEdit/hCaptcha' ]);
$wgHCaptchaSiteKey = 'your public/site key here';
$wgHCaptchaSecretKey = 'your private key here';

$wgHCaptchaSendRemoteIP is also available.

Turnstile

MediaWiki version:
1.42

The configuration is similar to #ReCaptcha or #hCaptcha:

wfLoadExtensions([ 'ConfirmEdit', 'ConfirmEdit/Turnstile' ]);
$wgTurnstileSiteKey= 'your public/site key here';
$wgTurnstileSecretKey= 'your private key here';

$wgTurnstileSendRemoteIP is also available.

Configuration

Don't require CAPTCHA from some users

ConfirmEdit introduces a 'skipcaptcha' permission type to wgGroupPermissions . This lets you set certain groups never to see CAPTCHAs. All of the following can be added to LocalSettings.php.

Defaults from ConfirmEdit.php:

$wgGroupPermissions['*']['skipcaptcha'] = false;
$wgGroupPermissions['user']['skipcaptcha'] = false;
$wgGroupPermissions['autoconfirmed']['skipcaptcha'] = false;
$wgGroupPermissions['bot']['skipcaptcha'] = true; // registered bots
$wgGroupPermissions['sysop']['skipcaptcha'] = true;

To skip captchas for users who confirmed their email, you need to set both:

$wgGroupPermissions['emailconfirmed']['skipcaptcha'] = true;
$wgAllowConfirmedEmail = true;

Set actions that require CAPTCHA

The following conditions can trigger a CAPTCHA to be displayed:

  • 'edit' - triggered on every attempted page save
  • 'create' - triggered on page creation
  • 'sendemail' - triggered when using Special:Emailuser
  • 'addurl' - triggered on a page save that would add one or more URLs to the page
  • 'createaccount' - triggered on creation of a new account
  • 'badlogin' - triggered after several failed login attempts from the same IP address
  • 'badloginperuser' - triggered after several failed login attempts using the same username

The default values for these are:

$wgCaptchaTriggers['edit'] = false;
$wgCaptchaTriggers['create'] = false;
$wgCaptchaTriggers['sendemail'] = false;
$wgCaptchaTriggers['addurl'] = true;
$wgCaptchaTriggers['createaccount'] = true;
$wgCaptchaTriggers['badlogin'] = true;
$wgCaptchaTriggers['badloginperuser'] = true;

The triggers edit, create and addurl can be configured per namespace using the $wgCaptchaTriggersOnNamespace setting. If there is no $wgCaptchaTriggersOnNamespace for the current namespace, the normal $wgCaptchaTriggers apply. So suppose that in addition to the above $wgCaptchaTriggers defaults we configure the following:

$wgCaptchaTriggersOnNamespace[NS_TALK]['addurl'] = false;
$wgCaptchaTriggersOnNamespace[NS_PROJECT]['edit'] = true;

Then the CAPTCHA will not trigger when adding URLs to a talk page, but on the other hand user will need to solve a CAPTCHA any time they try to edit a page in the project namespace, even if they aren't adding a link.

URL and IP whitelists

It is possible to define a whitelist of known good sites for which the CAPTCHA should not kick in when the 'addurl' action is triggered.

Sysop users can edit the system message page called MediaWiki:Captcha-addurl-whitelist.

The expected format is a set of regex's one per line.

Comments can be added with # prefix.

You can see an example of this usage on OpenStreetMap.

This set of whitelist regexes can also be defined using the $wgCaptchaWhitelist config variable in LocalSettings.php, to keep the value(s) a secret.

Some other variables you can add to LocalSettings.php:

  • $wgCaptchaWhitelistIP - List of IP ranges to allow to skip the CAPTCHA (you can also use MediaWiki:Captcha-ip-whitelist; see below for details).
  • $wgAllowConfirmedEmail - Allow users who have confirmed their e-mail addresses to post URL links.

These are described more thoroughly in the code comments

MediaWiki:Captcha-ip-whitelist can change the whitelisted IP addresses and IP ranges on the wiki.

They should be separated by newlines.

If any other character (apart from a valid IP address or range) is found on a line, it will be ignored, but leading and trailing whitespace characters are allowed.

For example, a line with only 127.0.0.1 is considered valid but #127.0.0.1 will be ignored.

Regular expressions

The global variable wgCaptchaRegexes accepts an array of regexes to be tested against the page text and triggers the CAPTCHA if a match is found.

Failed login attempts

When using the badlogin or badloginperuser triggers, the following configuration variables control how many failed login attempts per-IP and per-user are allowed before a CAPTCHA is required, and how long it takes until the CAPTCHA requirement expires:

$wgCaptchaBadLoginAttempts = 3;
$wgCaptchaBadLoginExpiration = 300; // 300 seconds = 5 minutes
$wgCaptchaBadLoginPerUserAttempts = 20;
$wgCaptchaBadLoginPerUserExpiration = 600; // 600 seconds = 10 minutes

The triggers require $wgMainCacheType to be set to something other than CACHE_NONE in your LocalSettings.php, if in doubt the following will always work.

$wgMainCacheType = CACHE_ANYTHING;

Note that these triggers do not trigger CAPTCHAs on API login but block them outright until the CAPTCHA requirement expires.

Wikimedia configuration

For example, Wikimedia Foundation wikis use FancyCaptcha with a custom set of images and the default configuration, modified by what follows.

$wgGroupPermissions['autoconfirmed']['skipcaptcha'] = true;

This means only unregistered and newly registered users have to pass the CAPTCHA.

EmergencyCaptcha mode

Additionally, the shortcut named $wmgEmergencyCaptcha is designed for use in a limited number of emergencies, for instance, in case of massive vandalism or spam attacks: it changes the default trigger values (see above) into the following:

$wgCaptchaTriggers['edit'] = true; 
$wgCaptchaTriggers['create'] = true;

So, in addition to the normal situation, all anonymous and new users have to solve a CAPTCHA before being able to save an edit or create a new page.

Rate-limiting

ConfirmEdit supports rate limiting for false CAPTCHA.

For more information about $wgRateLimits and how to set it up, read Manual:$wgRateLimits , the action key is badcaptcha.

Authors

The basic framework was primarily designed by Brion Vibber, who also wrote the SimpleCaptcha and FancyCaptcha modules.

The MathCaptcha module was written by Rob Church.

The QuestyCaptcha module was written by Benjamin Lees.

Additional maintenance work was done by Yaron Koren.

References

  1. MediaWiki:Questycaptchahelp-text, MediaWiki:Questycaptcha-edit, MediaWiki:Questycaptcha-addurl, MediaWiki:Questycaptcha-create, MediaWiki:Questycaptcha-createaccount
  2. Google Blog Are you a robot? Introducing “No CAPTCHA reCAPTCHA” ()

See also