Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F71138911
01-T413139.patch
STran (STran)
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Authored By
STran
Dec 19 2025, 8:25 AM
2025-12-19 08:25:46 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
01-T413139.patch
View Options
From 74a6dc17195589facc96118d28705164c92e7722 Mon Sep 17 00:00:00 2001
From: STran <stran@wikimedia.org>
Date: Fri, 19 Dec 2025 00:01:01 -0800
Subject: [PATCH] SECURTIY: Only show temp accounts on IP if temp accounts are
known
Why:
The function will fail fatally otherwise as it cannot count an unknown thing
What:
- Check `isKnown` before proceeding with shouldShowCountFromThisIP
Bug: T413139
Change-Id: I0cc87247ad08f7aebfde40924fffc49aeb902afc
---
.../SpecialContributionsBeforeMainOutputHandler.php | 6 +++++-
.../SpecialContributionsBeforeMainOutputHandlerTest.php | 8 ++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/HookHandler/SpecialContributionsBeforeMainOutputHandler.php b/src/HookHandler/SpecialContributionsBeforeMainOutputHandler.php
index 8da632f7..203eaed6 100644
--- a/src/HookHandler/SpecialContributionsBeforeMainOutputHandler.php
+++ b/src/HookHandler/SpecialContributionsBeforeMainOutputHandler.php
@@ -56,7 +56,11 @@ class SpecialContributionsBeforeMainOutputHandler implements SpecialContribution
}
private function shouldShowCountFromThisIP( UserIdentity $user, ContributionsSpecialPage $sp ): bool {
- if ( $user->isRegistered() || !$this->isValidIPOrQueryableRange( $user->getName(), $sp->getConfig() ) ) {
+ if (
+ !$this->tempUserConfig->isKnown() ||
+ $user->isRegistered() ||
+ !$this->isValidIPOrQueryableRange( $user->getName(), $sp->getConfig() )
+ ) {
return false;
}
diff --git a/tests/phpunit/integration/HookHandler/SpecialContributionsBeforeMainOutputHandlerTest.php b/tests/phpunit/integration/HookHandler/SpecialContributionsBeforeMainOutputHandlerTest.php
index f1271683..be8dda8e 100644
--- a/tests/phpunit/integration/HookHandler/SpecialContributionsBeforeMainOutputHandlerTest.php
+++ b/tests/phpunit/integration/HookHandler/SpecialContributionsBeforeMainOutputHandlerTest.php
@@ -193,6 +193,14 @@ class SpecialContributionsBeforeMainOutputHandlerTest extends MediaWikiIntegrati
'permissions' => [ 'checkuser-temporary-account-no-preference' ],
'expectedSubtitle' => 'checkuser-contributions-temporary-accounts-on-ip',
],
+ 'IP target, has TAIV right, temp accounts not known' => [
+ 'tempAccountsEnabled' => false,
+ 'target' => '127.0.0.1',
+ 'targetExists' => false,
+ 'targetHidden' => false,
+ 'permissions' => [ 'checkuser-temporary-account-no-preference' ],
+ 'expectedSubtitle' => null,
+ ]
];
}
}
--
2.48.1
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
22759188
Default Alt Text
01-T413139.patch (2 KB)
Attached To
Mode
T413139: [Ruwiki] Error message displayed while accessing Special:Contributions for an IP using an account with CU rights
Attached
Detach File
Event Timeline
Log In to Comment