Page MenuHomePhabricator

Make IPInfo tool available on Special:Log page
Closed, ResolvedPublic5 Estimated Story PointsOct 6 2020

Description

Following T260604, the IPInfo tool is available on history pages, using the revision API endpoint.

Make the tool available on Special:Log, using the log endpoint:

  • A button appears next to each link with class 'mw-anonuserlink'
  • Clicking the button queries the API using the log endpoint, which returns the mock data, which is displayed in the popup

This work depends on T263635 for getting data about the target of a log entry, as well as the performer.

Questions:

  • How would we know whether a particular link represents the performer or target of a log entry?

Details

Due Date
Oct 6 2020, 4:00 AM

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptSep 23 2020, 12:59 PM
Niharika triaged this task as Medium priority.Sep 23 2020, 4:34 PM
Niharika moved this task from Untriaged to Triage/To be Estimated on the Anti-Harassment board.

How would we know whether a particular link represents the performer or target of a log entry?

Note that we can't determine this from the order in the message. Example for logentry-block-unblock:

  • English translation: $1 {{GENDER:$2|unblocked}} {{GENDER:$4|$3}} - performer before target
  • Breton translation: {{GENDER:$2|Distanket}} eo bet {{GENDER:$4|$3}} gant $1 - target before performer

How would we know whether a particular link represents the performer or target of a log entry?

Summarising a discussion with @dbarratt.

Possible options include:

  1. Return the information for the performer and the target associated with the log ID. This is our favoured option - details below.
  2. Add something to the log entry HTML to identify performer and target, and have a separate API endpoint to get data for each of the performer and the target. This could be quite complex, because there are many formatter classes that generate log entry HTML. E.g. we may be able to add a performer class via LogFormatter::getPerformerElement, but we'd need to know that the subclasses would not replace the performer HTML - and this would need to be true for all future subclasses too. Adding an identifier to the target would be even more complex, since the target HTML is commonly modified by subclasses (though arguably the target could be assumed if not the performer). We may pursue this further in the future if necessary.
  3. Pass the IP address as a parameter. Advantage: this would always just work. Disadvantage: We'd have to take measures to ensure that the API could not be queried with arbitrary IP addresses (e.g. as outlined in T260821#6453709)

Details for option (1)

The log endpoint returns an Info object for the target and the performer:

{
	performer: {
		actor: '127.0.0.1',
		coordinates: ...,
		...
	},
	target: {
		actor: '::1',
		coordinates: ...,
		...
	}
}

The client then checks the IP address (from the HTML) against each actor, and displays the data that matches the button that was clicked.

Note that, although the response includes the IP address, this still does not allow for querying the endpoint for arbitrary IP addresses. When IPs are masked in the future, the actor will instead be the anonymous name.

Change 630882 had a related patch set uploaded (by Tchanders; owner: Tchanders):
[mediawiki/extensions/IPInfo@master] Make IPInfo available on Special:Log

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

Note that, although the response includes the IP address, this still does not allow for querying the endpoint for arbitrary IP addresses. When IPs are masked in the future, the actor will instead be the anonymous name.

It should be noted that the actor may not necessarily exist in the actor table. A user can preemptively block an IP address before any actions have been made from that address. I don't have a good alternative name as both actor and user have existing meanings in MediaWiki.

We could generate an id (a hash?) but that seems like overkill.

ARamirez_WMF changed the subtype of this task from "Task" to "Deadline".Sep 30 2020, 4:07 PM
ARamirez_WMF set Due Date to Oct 6 2020, 4:00 AM.

Change 630882 merged by jenkins-bot:
[mediawiki/extensions/IPInfo@master] Make IPInfo available on Special:Log

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