From aa91ab36c15212af9568160692dda23da3f15609 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Mon, 3 Mar 2008 11:29:49 +0000 Subject: [PATCH] API: Adding $wgAPIUCUserPrefixMinLength config variable to close a DOS window --- includes/DefaultSettings.php | 6 ++++++ includes/api/ApiQueryUserContributions.php | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 467ce3d726..b955d8662e 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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. diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index 1f589e3554..59a469f536 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -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']; } -- 2.20.1