Page MenuHomePhabricator

Create a log entry when the RevisionHandler is called
Closed, ResolvedPublic2 Estimated Story Points

Description

Motivation

Read epic task T292755: Epic: IP Info access for context.

By doing this task, a log entry should be created any time the infobox is accessed (since the infobox only uses RevisionHandler). Also when a popup is accessed on a history page (since this also uses RevisionHandler).

AC
  • Create a job that will log access to ip information (we opt for a job because we shouldn't write on the GET request) - done in T300825
  • If the RevisionHandler should return information about an IP, log it using the created job
Spec
  • When a user views the IP Info accordion, create a log entry
  • The log entry should capture:
    • Who performed the IP information check
    • Access level of the information viewed (limited or full)
    • Which IP address' information was viewed
    • Data context of the information (infobox or popup)
    • Timestamp of the check
  • Only one log entry should be created if the same user makes multiple checks against the same IP address over a period of 24 hours

Sample log entries (see more up-to-date versions at T295017):

User:A viewed limited IP Information accordion for 1.1.1.1 at October 22, 11:25 UTC
User:B viewed full IP Information accordion for 1.2.3.4 at October 28, 00:04 UTC

Details

Event Timeline

Niharika triaged this task as Medium priority.Oct 29 2021, 6:09 PM

Since the infobox (our name for the accordion) loads ip information if it can on page load, some changes should be made to when that information is loaded so that we can log on-load (as opposed to downstream on user action). The user doesn't necessarily have to see the information (eg. if they keep the accordion closed) so part of the goal of this proposal is to reduce conflating intent vs accidental exposure. I propose:

  • No longer loading on-load in all cases
  • If the user has the accordion preference set to 'open', the widget should check for that and load if so
  • if the user has no preference or the preference set to 'closed', then the widget should not load
  • only when the user opens the accordion should the ip info load

That way, we can log on every ip info api GET and know that, roughly, this corresponds to the user viewing ip information.

That way, we can log on every ip info api GET and know that, roughly, this corresponds to the user viewing ip information.

A hearty +1 to this point. We shouldn't fool ourselves into thinking that our UI will be the only way that our API is used – a user could create a user script and/or gadget, for example.

When we say "log", do we mean a Special:Log log or something on the backend? That's not obvious to me as a wiki user. (I have no opinion on which would be preferred and I don't know that has shown up in discussions in consultation.)

When we say "log", do we mean a Special:Log log or something on the backend? That's not obvious to me as a wiki user. (I have no opinion on which would be preferred and I don't know that has shown up in discussions in consultation.)

@Izno: Thanks for the clarifying question. Based on the outcome of T263756: Create a table to store which users have access to IPInfo, and the timestamp when access was granted [L], we mean Special:Log.

Change 736267 had a related patch set uploaded (by Phuedx; author: Phuedx):

[mediawiki/extensions/IPInfo@master] WIP: Add IPInfo log to Special:Log

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

phuedx renamed this task from IP Info: Create a log entry when the IP Info accordion is viewed to Create a log entry when the accordion is viewed.Nov 2 2021, 3:39 PM
phuedx updated the task description. (Show Details)
phuedx moved this task from Untriaged to Triage/To be Estimated on the Anti-Harassment-Team board.
ARamirez_WMF renamed this task from Create a log entry when the accordion is viewed to Create a log entry when the accordion is viewed [S].Dec 14 2021, 5:14 PM

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

[mediawiki/extensions/IPInfo@master] [WIP] Add access logging

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

Hm, it occurs to me that whether or not we load from the infobox or the popup, we pass along the same full set of information from the API. Would it be better then to log anytime anyone access the REST point? As @phuedx pointed out:

We shouldn't fool ourselves into thinking that our UI will be the only way that our API is used – a user could create a user script and/or gadget, for example.

I've uploaded a proof of concept as to how this could work (which also takes into account my concerns around conflating intent vs accidental exposure see: T294658#7469482)
cc @Prtksxna and maybe @Tchanders?

@STran I'm not sure I understand this. Would it mean that that a popup view (T294657) and an accordion view would be treated as the same thing?

Could these be considered two different calls one which has limited information and the other which has the full info? If they choose to, gadgets and tools could then decide which one they need.

@Prtksxna

@STran I'm not sure I understand this. Would it mean that that a popup view (T294657) and an accordion view would be treated as the same thing?

As far as "access to data" goes, yes. For instance, if I get this popup:

image.png (217×178 px, 16 KB)

There's nothing stopping me from investigating the data object that got passed along, which contains more information:

image.png (214×129 px, 16 KB)

Could these be considered two different calls one which has limited information and the other which has the full info? If they choose to, gadgets and tools could then decide which one they need.

They could be but I think that's a new ticket. I'm happy to write that up if that's what we want to go with. To confirm though, does this mean we're logging with the intent to track access?

To confirm though, does this mean we're logging with the intent to track access?

This was my understanding (though debouncing the log entries for a viewing the popup and the infobox makes this a little fuzzy).

/cc @Niharika

They could be but I think that's a new ticket. I'm happy to write that up if that's what we want to go with.

Yep, that is what we want to go with. You can create the new tickets, thanks!

ARamirez_WMF renamed this task from Create a log entry when the accordion is viewed [S] to Create a log entry when the accordion is viewed.Feb 8 2022, 5:00 PM
ARamirez_WMF set the point value for this task to 2.

The distinction between logging infobox and popup access isn't the same now that logging is done via the job. From the patch on this task:

$this->jobQueueGroup->push(
	new JobSpecification(
		'ipinfoLogIPInfoAccess',
		[
			'performer' => $user->getName(),
			'ip' => $author->getName(),
			'dataContext' => $dataContext
		],
		[],
		null
	)
);

The data context is what determines whether the job calls logViewInfobox or logViewPopup.

So separating this task out from T294657: Create a log entry when the LogHandler is called no longer makes sense. We could re-purpose them as logging via the RevisionHandler (this task) vs the LogHandler. Or we could merge the tasks and do it all at once. What do you think @STran ?

Let's split it up like you suggest (RevisionHandler vs LogHandler). I think it'll be good practice for someone.

STran renamed this task from Create a log entry when the accordion is viewed to Create a log entry when the RevisionHandler is called.Feb 10 2022, 2:17 PM
STran updated the task description. (Show Details)

Change 748184 merged by jenkins-bot:

[mediawiki/extensions/IPInfo@master] Add RevisionHandler access logging

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