API: Adding $wgAPIUCUserPrefixMinLength config variable to close a DOS window
authorRoan Kattouw <catrope@users.mediawiki.org>
Mon, 3 Mar 2008 11:29:49 +0000 (11:29 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Mon, 3 Mar 2008 11:29:49 +0000 (11:29 +0000)
includes/DefaultSettings.php
includes/api/ApiQueryUserContributions.php

index 467ce3d..b955d86 100644 (file)
@@ -2873,6 +2873,12 @@ $wgEnableWriteAPI = false;
  */
 $wgAPIModules = array();
 
+/**
+ * Minimum length of list=usercontribs's ucuserprefix parameter
+ * Setting this to a low value can open DOS windows on large wikis
+ */
+$wgAPIUCUserPrefixMinLength = 3;
+
 /**
  * Parser test suite files to be run by parserTests.php when no specific
  * filename is passed to it.
index 1f589e3..59a469f 100644 (file)
@@ -62,6 +62,10 @@ class ApiQueryContributions extends ApiQueryBase {
 
                if(isset($this->params['userprefix']))
                {
+                       global $wgAPIUCUserPrefixMinLength;
+                       if(strlen($this->params['userprefix']) < $wgAPIUCUserPrefixMinLength)
+                               $this->dieUsage("User prefixes must be at least $wgAPIUCUserPrefixMinLength characters", 'userprefix-tooshort');
+
                        $this->prefixMode = true;
                        $this->userprefix = $this->params['userprefix'];
                }