Page MenuHomePhabricator

IPReputation: Create a service to get IPoid data in IPReputation
Closed, ResolvedPublic

Description

Summary

Currently MediaWiki-extensions-IPReputation queries IPoid data only on account creations. For T354599, we need to also get this data for use in AbuseFilter protected filters. Access to the data should be similar for both uses, so a service can be created that de-duplicates this code.

Background

  • MediaWiki-extensions-IPReputation queries IPoid for data about IP addresses being used to be create accounts
    • This allows logging or potentially preventing the action if certain conditions are met based on the IPoid data
  • In T354599, some of this IPoid data is being provided to AbuseFilter protected filters
  • The data obtained by the account creation handler and the to be created AbuseFilter handler will come from the same feed URL, which at this stage cannot be filtered
    • Therefore, it makes sense to use a shared cache between the account creation handler and the AbuseFilter handler as both will need the same data

Technical notes

  • Should just involve refactoring PreAuthenticationProvider::getIPoidDataFor out to a service, and potentially making the return type a value object to further reduce duplication in handling the array response from the API

Acceptance criteria

  • A service is created that obtains IP reputation data from IPoid
  • This service is used by PreAuthenticationProvider::testForAccountCreation instead of it's private method that acquires the IPoid data

Event Timeline

Change #1121357 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/IPReputation@master] [Very WIP] Split IPoid data collection to service

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

Change #1121396 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/IPReputation@master] Create tests that cover IPReputationIPoidDataLookup independently

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

Change #1121400 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/IPReputation@master] Re-work PreAuthenticationProviderTest to mock IPoid lookup service

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

Change #1121408 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/IPReputation@master] [WIP] Refactor IPReputationIPoidDataLookup::getIPoidDataFor

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

Change #1121357 merged by jenkins-bot:

[mediawiki/extensions/IPReputation@master] Split IPoid data collection to service

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

Change #1121396 merged by jenkins-bot:

[mediawiki/extensions/IPReputation@master] Create tests that cover IPReputationIPoidDataLookup independently

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

For this ticket, all that is needed is a regression test. No functionality changes should have occurred with preventing account creations or logging.

To regression test you will need an ipoid service running locally and to put some test data into it.

Change #1121400 merged by jenkins-bot:

[mediawiki/extensions/IPReputation@master] Re-work PreAuthenticationProviderTest to mock IPoid lookup service

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

Change #1121408 merged by jenkins-bot:

[mediawiki/extensions/IPReputation@master] Refactor IPReputationIPoidDataLookup::getIPoidDataFor

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

dom_walden subscribed.

For this ticket, all that is needed is a regression test. No functionality changes should have occurred with preventing account creations or logging.

Thanks. I loaded some test data into ipoid, installed IPReputation and created a number of accounts from different IPs. I then compared which risks were reported in the logs by the IPReputation extension for those IPs with the risks that are listed in the ipoid test data.

Test environment: local docker IPReputation – (fda10f1) 12:19, 21 February 2025.