Page MenuHomePhabricator

Add hook to make it possible to check other open proxy lists besides $wgProxyList
Closed, DeclinedPublic

Description

I want to add a hook to make it possible to check other open proxy lists besides $wgProxyList. Specifically, the addProxies.php maintenance script creates a proxy table, populates it using the http://www.stopforumspam.com/downloads list, and then checks the user's IP address against it. That way, it's unnecessary to process the whole file each time a user edits; it suffices to check the database. See [[mw:Manual:AddProxies.php#Hack_User.php]].

The implementation I have thus far adds wfRunHooks( 'LocallyBlockedProxy', array( $ip, &$ret ) ); to User::isLocallyBlockedProxy().


Version: 1.23.0
Severity: enhancement

Details

Reference
bz62701

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 2:54 AM
bzimport set Reference to bz62701.
bzimport added a subscriber: Unknown Object (MLST).

Change 118942 had a related patch set uploaded by leucosticte:
Add LocallyBlockedProxy hook

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

Eh, can't you just use the userCan hook?

Also for SFS, you can use [[mw:Extension:StopForumSpam]] :)

Darn, wish I'd known about that extension yesterday. Anyway, it looks like you're right about the userCan hook; this adaptation of [[mw:Extension:RudeProxyBlock]] works:

$wgHooks['userCan'][] = 'efBlockOpenProxies';
$wgRudeProxyBlockDelimiter = "\n";

function efBlockOpenProxies( &$title, &$user, $action, &$result ) {
if ( $action == 'edit' ) {

		global $wgRudeProxyBlockDelimiter, $wgProxyList;
		$ip = $wgUser->getRequest()->getIP();
		$openProxies = explode( $wgRudeProxyBlockDelimiter, wfMsg( 'openproxylist' ) );
		if ( in_array( $ip, $openProxies ) ) {
			$wgProxyList[] = $ip;
		}

}
return true;
}

Change 118942 abandoned by leucosticte:
Add LocallyBlockedProxy hook

Reason:
Unnecessary; the userCan hook will suffice

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