Background
Following T300263: [IP Masking] Create temporary account on first edit, IP addresses for temporary accounts will only be stored in the CheckUser tables. This is by design, to protect user privacy.
However, IP addresses form an important part of anti-vandalism workflows, and need to be made visible to trusted users for these purposes.
IP addresses used by temporary account users will be visible to some trusted users who are not CheckUsers (to be defined, but see T300289: [IP Masking] IPViewer roles views temporary account users for example).
What needs to be done
We need CheckUser to be able to return, for users with a permission other than checkuser (name of new permission tbc):
- All IP addresses (up to a configurable limit), given a temporary account name (e.g. for T324602: SpecialBlock: Once a temporary account is selected, below the username field display IP addresses associated with the account)
- An IP address, given a temporary account name and a revision ID (for e.g. T326392: IP Address Reveal on History page)
- An IP address, given a temporary account name and a timestamp (e.g. for T326393: IP Address Reveal on Log page)
This should be done carefully and might be a new endpoint, to avoid the possibility of revealing sensitive information to users without the checkuser permission.
Notes
The cu_changes table doesn't guarantee that a particular combination of username/revId or username/timestamp will be unique, so there could in theory be multiple IP addresses associated with these. In that case, it won't be clear which one should be shown in a history line, log line, etc. For now we will just pick one, perhaps the most recent.
This work will be affected by T324907: Create separate tables for log events in CheckUser. After that task:
- we can look up a log entry by log ID in the cu_log_event table
- when looking for all IPs, we'll need to look in all the relevant tables
Testing notes
- To use this API, you'll need the checkuser-temporary-account right that's introduced in this patch
- The URL is rest.php/checkuser/v0/temporaryaccount/{name}, where {name} is the user name you want to look up (see RestRoutes in extension.json)
- You can add the optional params in TemporaryAccountHandler::getParamSettings via the querystring (e.g. ?revision=123, etc)
- In case you have been switching $wgAutoCreateTempUser['enabled'] on and off locally, it needs to be true to avoid a nonexistent account error