Merge "Add support for Argon2 password hashing"
[lhc/web/wiklou.git] / includes / DefaultSettings.php
index 358b466..9286591 100644 (file)
@@ -1234,7 +1234,7 @@ $wgAllowTitlesInSVG = false;
  *
  * @since 1.33
  */
-$wgMediaInTargetLanguage = false;
+$wgMediaInTargetLanguage = true;
 
 /**
  * The maximum number of pixels a source image can have if it is to be scaled
@@ -2456,23 +2456,20 @@ $wgMainWANCache = false;
  *
  * The format is an associative array where the key is a cache identifier, and
  * the value is an associative array of parameters. The "cacheId" parameter is
- * a cache identifier from $wgObjectCaches. The "channels" parameter is a map of
- * actions ('purge') to PubSub channels defined in $wgEventRelayerConfig.
- * The "loggroup" parameter controls where log events are sent.
+ * a cache identifier from $wgObjectCaches. The "loggroup" parameter controls
+ * where log events are sent.
  *
  * @since 1.26
  */
 $wgWANObjectCaches = [
        CACHE_NONE => [
                'class'    => WANObjectCache::class,
-               'cacheId'  => CACHE_NONE,
-               'channels' => []
+               'cacheId'  => CACHE_NONE
        ]
        /* Example of a simple single data-center cache:
        'memcached-php' => [
                'class'    => WANObjectCache::class,
-               'cacheId'  => 'memcached-php',
-               'channels' => [ 'purge' => 'wancache-main-memcached-purge' ]
+               'cacheId'  => 'memcached-php'
        ]
        */
 ];
@@ -2512,21 +2509,11 @@ $wgMainStash = 'db-replicated';
  */
 $wgParserCacheExpireTime = 86400;
 
-/**
- * @deprecated since 1.27, session data is always stored in object cache.
- */
-$wgSessionsInObjectCache = true;
-
 /**
  * The expiry time to use for session storage, in seconds.
  */
 $wgObjectCacheSessionExpiry = 3600;
 
-/**
- * @deprecated since 1.27, MediaWiki\Session\SessionManager doesn't use PHP session storage.
- */
-$wgSessionHandler = null;
-
 /**
  * Whether to use PHP session handling ($_SESSION and session_*() functions)
  *
@@ -2660,12 +2647,6 @@ $wgUseFileCache = false;
  */
 $wgFileCacheDepth = 2;
 
-/**
- * Kept for extension compatibility; see $wgParserCacheType
- * @deprecated since 1.26
- */
-$wgEnableParserCache = true;
-
 /**
  * Append a configured value to the parser cache and the sitenotice key so
  * that they can be kept separate for some class of activity.
@@ -4282,74 +4263,24 @@ $wgAllowImageTag = false;
 /**
  * Configuration for HTML postprocessing tool. Set this to a configuration
  * array to enable an external tool. By default, we now use the RemexHtml
- * library; historically, Dave Raggett's "HTML Tidy" was typically used.
- * See https://www.w3.org/People/Raggett/tidy/
- *
- * Setting this to null is deprecated.
- *
- * If this is null and $wgUseTidy is true, the deprecated configuration
- * parameters will be used instead.
- *
- * If this is null and $wgUseTidy is false, a pure PHP fallback will be used.
- * (Equivalent to setting `$wgTidyConfig['driver'] = 'disabled'`.)
- *
- * Keys are:
- *  - driver: May be:
- *    - RemexHtml: Use the RemexHtml library in PHP
- *    - RaggettInternalHHVM: Use the limited-functionality HHVM extension
- *      Deprecated since 1.32.
- *    - RaggettInternalPHP: Use the PECL extension
- *      Deprecated since 1.32.
- *    - RaggettExternal: Shell out to an external binary (tidyBin)
- *      Deprecated since 1.32.
- *    - disabled: Disable tidy pass and use a hacky pure PHP workaround
- *      (this is what setting $wgUseTidy to false used to do)
- *      Deprecated since 1.32.
- *
- *  - tidyConfigFile: Path to configuration file for any of the Raggett drivers
- *  - debugComment: True to add a comment to the output with warning messages
- *  - tidyBin: For RaggettExternal, the path to the tidy binary.
- *  - tidyCommandLine: For RaggettExternal, additional command line options.
+ * library; historically, other postprocessors were used.
+ *
+ * Setting this to null will use default settings.
+ *
+ * Keys include:
+ *  - driver: formerly used to select a postprocessor; now ignored.
+ *  - treeMutationTrace: a boolean to turn on Remex tracing
+ *  - serializerTrace: a boolean to turn on Remex tracing
+ *  - mungerTrace: a boolean to turn on Remex tracing
+ *  - pwrap: whether <p> wrapping should be done (default true)
+ *
+ * See includes/tidy/RemexDriver.php for detail on configuration.
+ *
+ * Overriding the default configuration is strongly discouraged in
+ * production.
  */
 $wgTidyConfig = [ 'driver' => 'RemexHtml' ];
 
-/**
- * Set this to true to use the deprecated tidy configuration parameters.
- * @deprecated since 1.26, use $wgTidyConfig['driver'] = 'disabled'
- */
-$wgUseTidy = false;
-
-/**
- * The path to the tidy binary.
- * @deprecated since 1.26, use $wgTidyConfig['tidyBin']
- */
-$wgTidyBin = 'tidy';
-
-/**
- * The path to the tidy config file
- * @deprecated since 1.26, use $wgTidyConfig['tidyConfigFile']
- */
-$wgTidyConf = $IP . '/includes/tidy/tidy.conf';
-
-/**
- * The command line options to the tidy binary
- * @deprecated since 1.26, use $wgTidyConfig['tidyCommandLine']
- */
-$wgTidyOpts = '';
-
-/**
- * Set this to true to use the tidy extension
- * @deprecated since 1.26, use $wgTidyConfig['driver']
- */
-$wgTidyInternal = extension_loaded( 'tidy' );
-
-/**
- * Put tidy warnings in HTML comments
- * Only works for internal tidy.
- * @deprecated since 1.26, use $wgTidyConfig['debugComment']
- */
-$wgDebugTidy = false;
-
 /**
  * Allow raw, unchecked HTML in "<html>...</html>" sections.
  * THIS IS VERY DANGEROUS on a publicly editable site, so USE wgGroupPermissions
@@ -4501,57 +4432,78 @@ $wgCentralIdLookupProviders = [
 $wgCentralIdLookupProvider = 'local';
 
 /**
- * Password policy for local wiki users. A user's effective policy
- * is the superset of all policy statements from the policies for the
- * groups where the user is a member. If more than one group policy
- * include the same policy statement, the value is the max() of the
- * values. Note true > false. The 'default' policy group is required,
- * and serves as the minimum policy for all users. New statements can
- * be added by appending to $wgPasswordPolicy['checks'].
- * Statements:
- *     - MinimalPasswordLength - minimum length a user can set
- *     - MinimumPasswordLengthToLogin - passwords shorter than this will
+ * Password policy for the wiki.
+ * Structured as
+ * [
+ *     'policies' => [ <group> => [ <policy> => <settings>, ... ], ... ],
+ *     'checks' => [ <policy> => <callback>, ... ],
+ * ]
+ * where <group> is a user group, <policy> is a password policy name
+ * (arbitrary string) defined in the 'checks' part, <callback> is the
+ * PHP callable implementing the policy check, <settings> is an array
+ * of options with the following keys:
+ * - value: (number, boolean or null) the value to pass to the callback
+ * - forceChange: (bool, default false) if the password is invalid, do
+ *   not let the user log in without changing the password
+ * As a shorthand for [ 'value' => <value> ], simply <value> can be written.
+ * When multiple password policies are defined for a user, the settings
+ * arrays are merged, and for fields which are set in both arrays, the
+ * larger value (as understood by PHP's 'max' method) is taken.
+ *
+ * A user's effective policy is the superset of all policy statements
+ * from the policies for the groups where the user is a member. If more
+ * than one group policy include the same policy statement, the value is
+ * the max() of the values. Note true > false. The 'default' policy group
+ * is required, and serves as the minimum policy for all users.
+ *
+ * Callbacks receive three arguments: the policy value, the User object
+ * and the password; and must return a StatusValue. A non-good status
+ * means the password will not be accepted for new accounts, and existing
+ * accounts will be prompted for password change or barred from logging in
+ * (depending on whether the status is a fatal or merely error/warning).
+ *
+ * The checks supported by core are:
+ *     - MinimalPasswordLength - Minimum length a user can set.
+ *     - MinimumPasswordLengthToLogin - Passwords shorter than this will
  *             not be allowed to login, regardless if it is correct.
  *     - MaximalPasswordLength - maximum length password a user is allowed
  *             to attempt. Prevents DoS attacks with pbkdf2.
- *     - PasswordCannotMatchUsername - Password cannot match username to
+ *     - PasswordCannotMatchUsername - Password cannot match the username.
  *     - PasswordCannotMatchBlacklist - Username/password combination cannot
- *             match a specific, hardcoded blacklist.
+ *             match a blacklist of default passwords used by MediaWiki in the past.
  *     - PasswordCannotBePopular - Blacklist passwords which are known to be
  *             commonly chosen. Set to integer n to ban the top n passwords.
  *             If you want to ban all common passwords on file, use the
  *             PHP_INT_MAX constant.
+ *             Deprecated since 1.33. Use PasswordNotInLargeBlacklist instead.
  *     - PasswordNotInLargeBlacklist - Password not in best practices list of
- *             100,000 commonly used passwords.
+ *             100,000 commonly used passwords. Due to the size of the list this
+ *      is a probabilistic test.
+ *
  * @since 1.26
+ * @see PasswordPolicyChecks
+ * @see User::checkPasswordValidity()
  */
 $wgPasswordPolicy = [
        'policies' => [
                'bureaucrat' => [
-                       'MinimalPasswordLength' => 8,
+                       'MinimalPasswordLength' => 10,
                        'MinimumPasswordLengthToLogin' => 1,
-                       'PasswordCannotMatchUsername' => true,
-                       'PasswordCannotBePopular' => 25,
                        'PasswordNotInLargeBlacklist' => true,
                ],
                'sysop' => [
-                       'MinimalPasswordLength' => 8,
+                       'MinimalPasswordLength' => 10,
                        'MinimumPasswordLengthToLogin' => 1,
-                       'PasswordCannotMatchUsername' => true,
-                       'PasswordCannotBePopular' => 25,
                        'PasswordNotInLargeBlacklist' => true,
                ],
                'interface-admin' => [
-                       'MinimalPasswordLength' => 8,
+                       'MinimalPasswordLength' => 10,
                        'MinimumPasswordLengthToLogin' => 1,
-                       'PasswordCannotMatchUsername' => true,
-                       'PasswordCannotBePopular' => 25,
                        'PasswordNotInLargeBlacklist' => true,
                ],
                'bot' => [
-                       'MinimalPasswordLength' => 8,
+                       'MinimalPasswordLength' => 10,
                        'MinimumPasswordLengthToLogin' => 1,
-                       'PasswordCannotMatchUsername' => true,
                        'PasswordNotInLargeBlacklist' => true,
                ],
                'default' => [
@@ -4559,7 +4511,6 @@ $wgPasswordPolicy = [
                        'PasswordCannotMatchUsername' => true,
                        'PasswordCannotMatchBlacklist' => true,
                        'MaximalPasswordLength' => 4096,
-                       'PasswordNotInLargeBlacklist' => false,
                ],
        ],
        'checks' => [
@@ -4831,6 +4782,24 @@ $wgPasswordConfig = [
                'cost' => '30000',
                'length' => '64',
        ],
+       'argon2' => [
+               'class' => Argon2Password::class,
+
+               // Algorithm used:
+               // * 'argon2i' is optimized against side-channel attacks (PHP 7.2+)
+               // * 'argon2id' is optimized against both side-channel and GPU cracking (PHP 7.3+)
+               // * 'auto' to use best available algorithm. If you're using more than one server, be
+               //   careful when you're mixing PHP versions because newer PHP might generate hashes that
+               //   older versions might would not understand.
+               'algo' => 'auto',
+
+               // The parameters below are the same as options accepted by password_hash().
+               // Set them to override that function's defaults.
+               //
+               // 'memory_cost' => PASSWORD_ARGON2_DEFAULT_MEMORY_COST,
+               // 'time_cost' => PASSWORD_ARGON2_DEFAULT_TIME_COST,
+               // 'threads' => PASSWORD_ARGON2_DEFAULT_THREADS,
+       ],
 ];
 
 /**
@@ -5025,6 +4994,10 @@ $wgAutoblockExpiry = 86400;
 
 /**
  * Set this to true to allow blocked users to edit their own user talk page.
+ *
+ * This only applies to sitewide blocks. Partial blocks always allow users to
+ * edit their own user talk page unless otherwise specified in the block
+ * restrictions.
  */
 $wgBlockAllowsUTEdit = true;
 
@@ -5866,6 +5839,7 @@ $wgGrantPermissions['editmycssjs']['editmyuserjson'] = true;
 $wgGrantPermissions['editmycssjs']['editmyuserjs'] = true;
 
 $wgGrantPermissions['editmyoptions']['editmyoptions'] = true;
+$wgGrantPermissions['editmyoptions']['editmyuserjson'] = true;
 
 $wgGrantPermissions['editinterface'] = $wgGrantPermissions['editpage'];
 $wgGrantPermissions['editinterface']['editinterface'] = true;
@@ -5917,6 +5891,8 @@ $wgGrantPermissions['delete']['deletelogentry'] = true;
 $wgGrantPermissions['delete']['deleterevision'] = true;
 $wgGrantPermissions['delete']['undelete'] = true;
 
+$wgGrantPermissions['oversight']['suppressrevision'] = true;
+
 $wgGrantPermissions['protect'] = $wgGrantPermissions['editprotected'];
 $wgGrantPermissions['protect']['protect'] = true;
 
@@ -5962,6 +5938,7 @@ $wgGrantPermissionGroups = [
        'viewdeleted'         => 'administration',
        'viewrestrictedlogs'  => 'administration',
        'protect'             => 'administration',
+       'oversight'           => 'administration',
        'createaccount'       => 'administration',
 
        'highvolume'          => 'high-volume',
@@ -8618,6 +8595,9 @@ $wgUploadMaintenance = false;
  * defined for a given namespace, pages in that namespace will use the CONTENT_MODEL_WIKITEXT
  * (except for the special case of JS and CS pages).
  *
+ * @note To determine the default model for a new page's main slot, or any slot in general,
+ * use SlotRoleHandler::getDefaultModel() together with SlotRoleRegistry::getRoleHandler().
+ *
  * @since 1.21
  */
 $wgNamespaceContentModels = [];
@@ -8804,6 +8784,7 @@ $wgSearchRunSuggestedQuery = true;
  *
  * @see maintenance/createCommonPasswordCdb.php
  * @since 1.27
+ * @deprecated since 1.33
  * @var string path to file
  */
 $wgPopularPasswordFile = __DIR__ . '/password/commonpasswords.cdb';
@@ -8988,13 +8969,6 @@ $wgExperiencedUserMemberSince = 30; # days
  */
 $wgInterwikiPrefixDisplayTypes = [];
 
-/**
- * Comment table schema migration stage.
- * @since 1.30
- * @var int One of the MIGRATION_* constants
- */
-$wgCommentTableSchemaMigrationStage = MIGRATION_NEW;
-
 /**
  * RevisionStore table schema migration stage (content, slots, content_models & slot_roles tables).
  * Use the SCHEMA_COMPAT_XXX flags. Supported values:
@@ -9038,12 +9012,21 @@ $wgActorTableSchemaMigrationStage = SCHEMA_COMPAT_OLD;
  * Flag to enable Partial Blocks. This allows an admin to prevent a user from editing specific pages
  * or namespaces.
  *
- * @since 1.32
- * @deprecated 1.32
+ * @since 1.33
+ * @deprecated 1.33
  * @var bool
  */
 $wgEnablePartialBlocks = false;
 
+/**
+ * Enable confirmation prompt for rollback actions to prevent accidental rollbacks.
+ * May be disabled to reduce number of clicks needed to perform rollbacks.
+ *
+ * @since 1.33
+ * @var bool
+ */
+$wgEnableRollbackConfirmationPrompt = true;
+
 /**
  * Enable stats monitoring when Block Notices are displayed in different places around core
  * and extensions.