Page MenuHomePhabricator

External variables aren't computed when examining past edits
Open, Needs TriagePublic

Description

Some of the external variables in AbuseFilter (at least user_mobile and user_app, maybe more) are correctly computed while the edit is being saved, so filters using them work as intended. However, they aren't computed for edits in RC. To see it, head on any wiki, find an edit performed via mobile site/app (e.g. searching on Special:Tags), examine it in AbuseFilter and check for the values of user_app/user_mobile: you'll see that such variables are false.
This happens because in getVarsFromRCRow (and sub-methods) we use generateUserVars to compute such variables, which in turn runs the AbuseFilter-generateUserVars hook, used by other extensions. However, the method used by such extensions to determine the variable value is not suitable for RC edits, and thus fails. We should make the change there, but I'm wondering how. Maybe read the change tags?

Event Timeline

Daimona created this task.Aug 30 2018, 2:44 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 30 2018, 2:44 PM

Change 456402 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Add a parameter to generate(User|Title)Vars hooks to specify context

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

Change 456408 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/MobileFrontend@master] Update AbuseFilter hook for user_mobile variable

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

Change 456409 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/MobileApp@master] Update AbuseFilter hook for user_app variable

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

Change 456415 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/WikimediaEvents@master] Update AbuseFilter hook for user_wpzero variable

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

Daimona claimed this task.Aug 30 2018, 4:58 PM

Change 456402 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Add a parameter to generate(User|Title)Vars hooks to specify context

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

Change 456402 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Add a parameter to generate(User|Title)Vars hooks to specify context

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

Change 456415 abandoned by Daimona Eaytoy:
Update AbuseFilter hook for user_wpzero variable

Reason:
This code was killed

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

This patch (7 months ago) added a public lookup method for change tags. This is exactly what we needed to move on.

Change 456408 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/MobileFrontend@master] Update AbuseFilter hook for user_mobile variable

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

Change 456409 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/MobileApp@master] Update AbuseFilter hook for user_app variable

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

Jdlrobson added subscribers: Reedy, Jdlrobson.

This requires a change to MobileFrontend, however review of that change is currently blocked on change to core. @Reedy as the last person who touched includes/logging/RCDatabaseLogEntry.php do you know which team maintains that part of the code and could help with review?

Please re-add "Readers-Web-Backlog" when a review is needed for the MobileFrontend part of this change.