| 1 | ConfirmEdit |
| 2 | ========= |
| 3 | |
| 4 | ConfirmEdit extension for MediaWiki |
| 5 | |
| 6 | This extension provides various CAPTCHA tools for MediaWiki, to allow |
| 7 | for protection against spambots and other automated tools. |
| 8 | |
| 9 | You must set `$wgCaptchaClass` to a chosen module, otherwise |
| 10 | the demo captcha will be used. For example, to use FancyCaptcha: |
| 11 | |
| 12 | ```php |
| 13 | $wgCaptchaClass = 'FancyCaptcha'; |
| 14 | ```` |
| 15 | |
| 16 | The following modules are included in ConfirmEdit: |
| 17 | |
| 18 | * `SimpleCaptcha` - users have to solve an arithmetic math problem |
| 19 | * `FancyCaptcha` - users have to identify a series of characters, displayed |
| 20 | in a stylized way |
| 21 | * `QuestyCaptcha` - users have to answer a question, out of a series of |
| 22 | questions defined by the administrator(s) |
| 23 | * `ReCaptchaNoCaptcha` - users have to solve different types of visually or |
| 24 | audially tasks. |
| 25 | * `hCaptcha` - users have to solve visual tasks |
| 26 | * `Turnstile` - users check a box, which runs some client-side JS |
| 27 | heuristics |
| 28 | |
| 29 | For more information, see the extension homepage at: |
| 30 | https://www.mediawiki.org/wiki/Extension:ConfirmEdit |
| 31 | |
| 32 | ### License |
| 33 | |
| 34 | ConfirmEdit is published under the GPL license. |
| 35 | |
| 36 | ### Authors |
| 37 | |
| 38 | The main framework, and the SimpleCaptcha and FancyCaptcha modules, were |
| 39 | written by Brooke Vibber. |
| 40 | |
| 41 | The QuestyCaptcha module was written by Benjamin Lees. |
| 42 | |
| 43 | Additional maintenance work was done by Yaron Koren. |
| 44 | |
| 45 | ### Configuration comments |
| 46 | ```php |
| 47 | /** |
| 48 | * Needs to be explicitly set to the Captcha implementation you want to use, otherwise it will use a demo captcha. |
| 49 | * |
| 50 | * For example, to use FancyCaptcha: |
| 51 | * ``` |
| 52 | * $wgCaptchaClass ='FancyCaptcha'; |
| 53 | * ``` |
| 54 | */ |
| 55 | $wgCaptchaClass = 'SimpleCaptcha'; |
| 56 | |
| 57 | /** |
| 58 | * List of IP ranges to allow to skip the captcha, similar to the group setting: |
| 59 | * "$wgGroupPermission[...]['skipcaptcha'] = true" |
| 60 | * |
| 61 | * Specific IP addresses or CIDR-style ranges may be used, |
| 62 | * for instance: |
| 63 | * $wgCaptchaBypassIPs = [ '192.168.1.0/24', '10.1.0.0/16' ]; |
| 64 | */ |
| 65 | $wgCaptchaBypassIPs = false; |
| 66 | |
| 67 | /** |
| 68 | * Actions which can trigger a captcha |
| 69 | * |
| 70 | * If the 'edit' trigger is on, *every* edit will trigger the captcha. |
| 71 | * This may be useful for protecting against vandalbot attacks. |
| 72 | * |
| 73 | * If using the default 'addurl' trigger, the captcha will trigger on |
| 74 | * edits that include URLs that aren't in the current version of the page. |
| 75 | * This should catch automated linkspammers without annoying people when |
| 76 | * they make more typical edits. |
| 77 | * |
| 78 | * The captcha code should not use $wgCaptchaTriggers, but CaptchaTriggers() |
| 79 | * which also takes into account per namespace triggering. |
| 80 | */ |
| 81 | $wgCaptchaTriggers = []; |
| 82 | $wgCaptchaTriggers['edit'] = false; // Would check on every edit |
| 83 | $wgCaptchaTriggers['create'] = false; // Check on page creation. |
| 84 | $wgCaptchaTriggers['sendemail'] = false; // Special:Emailuser |
| 85 | $wgCaptchaTriggers['addurl'] = true; // Check on edits that add URLs |
| 86 | $wgCaptchaTriggers['createaccount'] = true; // Special:Userlogin&type=signup |
| 87 | $wgCaptchaTriggers['badlogin'] = true; // Special:Userlogin after failure |
| 88 | |
| 89 | /** |
| 90 | * You may wish to apply special rules for captcha triggering on some namespaces. |
| 91 | * $wgCaptchaTriggersOnNamespace[<namespace id>][<trigger>] forces an always on / |
| 92 | * always off configuration with that trigger for the given namespace. |
| 93 | * Leave unset to use the global options ($wgCaptchaTriggers). |
| 94 | * |
| 95 | * Shall not be used with 'createaccount' (it is not checked). |
| 96 | */ |
| 97 | $wgCaptchaTriggersOnNamespace = []; |
| 98 | |
| 99 | # Example: |
| 100 | # $wgCaptchaTriggersOnNamespace[NS_TALK]['create'] = false; //Allow creation of talk pages without captchas. |
| 101 | # $wgCaptchaTriggersOnNamespace[NS_PROJECT]['edit'] = true; //Show captcha whenever editing Project pages. |
| 102 | |
| 103 | /** |
| 104 | * Indicate how to store per-session data required to match up the |
| 105 | * internal captcha data with the editor. |
| 106 | * |
| 107 | * 'MediaWiki\Extension\ConfirmEdit\Store\CaptchaSessionStore' uses PHP's session storage, which is cookie-based |
| 108 | * and may fail for anons with cookies disabled. |
| 109 | * |
| 110 | * 'CaptchaCacheStore' uses MediaWiki core's MicroStash, |
| 111 | * for storing captch data with a TTL eviction strategy. |
| 112 | */ |
| 113 | $wgCaptchaStorageClass = 'MediaWiki\Extension\ConfirmEdit\Store\CaptchaSessionStore'; |
| 114 | |
| 115 | /** |
| 116 | * Number of seconds a captcha session should last in the data cache |
| 117 | * before expiring when managing through CaptchaCacheStore class. |
| 118 | * |
| 119 | * Default is a half-hour. |
| 120 | */ |
| 121 | $wgCaptchaSessionExpiration = 30 * 60; |
| 122 | |
| 123 | /** |
| 124 | * Number of seconds after a bad login (from a specific IP address) that a captcha will be shown to |
| 125 | * that client on the login form to slow down password-guessing bots. |
| 126 | * |
| 127 | * A longer expiration time of $wgCaptchaBadLoginExpiration * 300 will also be applied against a |
| 128 | * login attempt count of $wgCaptchaBadLoginAttempts * 30. |
| 129 | * |
| 130 | * Has no effect if 'badlogin' is disabled in $wgCaptchaTriggers or |
| 131 | * if there is not a caching engine enabled. |
| 132 | * |
| 133 | * Default is five minutes. |
| 134 | */ |
| 135 | $wgCaptchaBadLoginExpiration = 5 * 60; |
| 136 | |
| 137 | /** |
| 138 | * Number of seconds after a bad login (for a specific user account) that a captcha will be shown to |
| 139 | * that client on the login form to slow down password-guessing bots. |
| 140 | * |
| 141 | * A longer expiration time of $wgCaptchaBadLoginExpiration * 300 will be applied against a login |
| 142 | * attempt count of $wgCaptchaBadLoginAttempts * 30. |
| 143 | * |
| 144 | * Has no effect if 'badlogin' is disabled in $wgCaptchaTriggers or |
| 145 | * if there is not a caching engine enabled. |
| 146 | * |
| 147 | * Default is 10 minutes |
| 148 | */ |
| 149 | $wgCaptchaBadLoginPerUserExpiration = 10 * 60; |
| 150 | |
| 151 | /** |
| 152 | * Allow users who have confirmed their email addresses to post |
| 153 | * URL links without being shown a captcha. |
| 154 | * |
| 155 | * @deprecated since 1.36 |
| 156 | * $wgGroupPermissions['emailconfirmed']['skipcaptcha'] = true; should be used instead. |
| 157 | */ |
| 158 | $wgAllowConfirmedEmail = false; |
| 159 | |
| 160 | /** |
| 161 | * Number of bad login attempts (from a specific IP address) before triggering the captcha. 0 means the |
| 162 | * captcha is presented on the first login. |
| 163 | * |
| 164 | * A captcha will also be triggered if the number of failed logins exceeds $wgCaptchaBadLoginAttempts * 30 |
| 165 | * in a period of $wgCaptchaBadLoginExpiration * 300. |
| 166 | */ |
| 167 | $wgCaptchaBadLoginAttempts = 3; |
| 168 | |
| 169 | /** |
| 170 | * Number of bad login attempts (for a specific user account) before triggering the captcha. 0 means the |
| 171 | * captcha is presented on the first login. |
| 172 | * |
| 173 | * A captcha will also be triggered if the number of failed logins exceeds $wgCaptchaBadLoginPerUserAttempts * 30 |
| 174 | * in a period of $wgCaptchaBadLoginPerUserExpiration * 300. |
| 175 | */ |
| 176 | $wgCaptchaBadLoginPerUserAttempts = 20; |
| 177 | |
| 178 | /** |
| 179 | * Regex to ignore URLs to known-good sites... |
| 180 | * For instance: |
| 181 | * $wgCaptchaIgnoredUrls = '#^https?://([a-z0-9-]+\\.)?(wikimedia|wikipedia)\.org/#i'; |
| 182 | * Local admins can define a local allow list under [[MediaWiki:captcha-addurl-whitelist]] |
| 183 | */ |
| 184 | $wgCaptchaIgnoredUrls = false; |
| 185 | |
| 186 | /** |
| 187 | * Additional regexes to check for. Use full regexes; can match things |
| 188 | * other than URLs such as junk edits. |
| 189 | * |
| 190 | * If the new version matches one and the old version doesn't, |
| 191 | * show the captcha screen. |
| 192 | * |
| 193 | * @fixme Add a message for local admins to add items as well. |
| 194 | */ |
| 195 | $wgCaptchaRegexes = []; |
| 196 | |
| 197 | /** |
| 198 | * Feature flag to toggle list of available custom actions to enable in AbuseFilter. See AbuseFilterHooks::onAbuseFilterCustomActions |
| 199 | */ |
| 200 | $wgConfirmEditEnabledAbuseFilterCustomActions = []; |
| 201 | ``` |