Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2898302
T71367_03_AbuseFilter.patch
dpatrick (Darian Anthony Patrick)
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Authored By
•
dpatrick
Oct 30 2015, 7:00 PM
2015-10-30 19:00:27 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
T71367_03_AbuseFilter.patch
View Options
From 122c4b318eaeff177510d1c876a31628850ce3f8 Mon Sep 17 00:00:00 2001
From: Darian Anthony Patrick <dpatrick@wikimedia.org>
Date: Tue, 13 Oct 2015 14:25:00 -0700
Subject: [PATCH] Prevent article_recent_contributors leaking revdeleted user
names
This patch depends on a correspoding patch to core, which has been
attached to the bug listed below.
Bug: T71367
Change-Id: I68d38aaed495016ff2fd0c05bee348fc5477ab23
---
AbuseFilterVariableHolder.php | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/AbuseFilterVariableHolder.php b/AbuseFilterVariableHolder.php
index 6b17370..77aded4 100644
--- a/AbuseFilterVariableHolder.php
+++ b/AbuseFilterVariableHolder.php
@@ -500,24 +500,30 @@ class AFComputedVariable {
}
$dbr = wfGetDB( DB_SLAVE );
- $sqlTmp = $dbr->selectSQLText(
+ $limit = 100;
+ $res = $dbr->select(
'revision',
- array( 'rev_user_text', 'rev_timestamp' ),
- array( 'rev_page' => $title->getArticleID() ),
+ array( 'rev_id' ),
+ array(
+ 'rev_page' => $title->getArticleID(),
+ 'rev_timestamp < ' . $dbr->addQuotes( $dbr->timestamp( $cutOff ) )
+ ),
__METHOD__,
// Some pages have < 10 authors but many revisions (e.g. bot pages)
- array( 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' => 100 )
+ array( 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' => $limit )
);
- $res = $dbr->query(
- "SELECT rev_user_text FROM ($sqlTmp) AS tmp " .
- "GROUP BY rev_user_text ORDER BY MAX(rev_timestamp) DESC LIMIT 10",
- __METHOD__
+
+ $from = $res->fetchRow();
+ $res->seek($res->numRows());
+ $to = $res->fetchRow();
+
+ $users = $title->getAuthorsBetween(
+ $from['rev_id'],
+ $to['rev_id'],
+ $limit,
+ array( 'include_both' => true, 'visibility' => Revision::FOR_THIS_USER )
);
- $users = array();
- foreach( $res as $row ) {
- $users[] = $row->rev_user_text;
- }
$result = $users;
break;
case 'load-first-author':
--
2.3.8 (Apple Git-58)
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2909665
Default Alt Text
T71367_03_AbuseFilter.patch (2 KB)
Attached To
Mode
T71367: page_recent_contributors leaks revdeleted user names (CVE-2021-31545)
Attached
Detach File
Event Timeline
Log In to Comment