Page MenuHomePhabricator

Reorder order of operations to reduce unnecessary logspam
Closed, ResolvedPublic

Description

If you currently look at the logs, it would look like I'm editing from a StopForumSpam listed IP (I'm not), and then being exempt due to the order of operations.

Screenshot 2022-08-17 at 19.25.43.png (906×1 px, 247 KB)

Looking at a similar extension, namely MediaWiki-extensions-TorBlock, the code does the check for an exit IP pretty early:

	private static function checkUserCan( User $user, $action = null ) {
		global $wgTorAllowedActions, $wgRequest;

		if ( ( $action !== null && in_array( $action, $wgTorAllowedActions ) )
			|| !TorExitNodes::isExitNode()
		) {
			return true;
		}

It feels we should move

		$denyListManager = DenyListManager::singleton();
		if ( !$denyListManager->isIpDenyListed( $ip ) ) {
			return true;
		}

earlier, possibly after the early cheap checks, but before we do the other exemptions after $logger = LoggerFactory::getInstance( 'StopForumSpam' );

Event Timeline

Change 824258 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/StopForumSpam@master] Hooks: Move check if IP is denied earlier

https://gerrit.wikimedia.org/r/824258

sbassett changed the task status from Open to In Progress.Sep 2 2022, 9:46 PM
sbassett claimed this task.
sbassett triaged this task as Medium priority.
sbassett added a project: user-sbassett.
sbassett moved this task from Backlog to In Progress on the MediaWiki-extensions-StopForumSpam board.
sbassett moved this task from Backlog to In Progress on the user-sbassett board.

Change 824258 merged by jenkins-bot:

[mediawiki/extensions/StopForumSpam@master] Hooks: Refactor conditional logic and logging

https://gerrit.wikimedia.org/r/824258

sbassett moved this task from In Progress to Done on the MediaWiki-extensions-StopForumSpam board.
sbassett moved this task from In Progress to Done on the user-sbassett board.