Page MenuHomePhabricator

RevisionHandler should check whether author is an IP address before looking up data
Closed, ResolvedPublic2 Estimated Story Points

Description

RevisionHandler returns data for a non-IP editor (treated as anonymous because the edits were imported). It should instead return an error.

Example: https://en.wikipedia.beta.wmflabs.org/w/rest.php/ipinfo/v0/revision/550492?dataContext=infobox

Related code: https://gerrit.wikimedia.org/g/mediawiki/extensions/IPInfo/+/db645722220599e34fe0bc33e1363cfed69da853/src/Rest/Handler/RevisionHandler.php#186

Event Timeline

dom_walden subscribed.

I believe one side affect of this is the error on beta (recorded here: T309400#8025778). There are records in the logs of IPInfo lookups which are not of actual IP addresses.

AGueyte set the point value for this task to 2.Jun 27 2022, 5:38 PM

Change 809908 had a related patch set uploaded (by STran; author: STran):

[mediawiki/extensions/IPInfo@master] Ensure author of revision is an IP before lookup

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

Change 809908 merged by jenkins-bot:

[mediawiki/extensions/IPInfo@master] Ensure author of revision is an IP before lookup

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

I looked up 100 revisions which had been added by importing articles on beta.

I looked up 100 revisions by users who are anonymous but not IPs (their actor_name in the actor database table is NULL).

There were no logs recorded when looking up ipinfo for edits of users who are not IP addresses.

Where the user was "anonymous", the API returns an error: Cannot retrieve IP info for a non-IP author.

In case of regressions, I looked up the latest 500 edits on beta. It behaved as it should (based on my own experience).

Test environment: https://en.wikipedia.beta.wmflabs.org IP Info 0.0.0 (79d783b) 14:03, 1 July 2022.