Page MenuHomePhabricator

Create filters to distinguish anonymous/temporary/registered users
Closed, ResolvedPublic2 Estimated Story Points

Description

AbuseFilter filters occasionally want to distinguish between unlogged in users and users with accounts. No such filter exists although there are some workarounds. We should just make these filters explicit ahead of the temp accounts rollout because IPs won't be readily available anymore.

QA Results - Local

Event Timeline

Change 1006965 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/AbuseFilter@master] [WIP] Add user_type variable

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

Change 1006965 merged by jenkins-bot:

[mediawiki/extensions/AbuseFilter@master] Add user_type variable

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

Suggested QA steps:

  1. Create a filter with the sole condition as user_type = 'ip' set to log only
  2. Disable temporary accounts on your wiki
  3. Make a testing edit and verify that it matches the abuse filter (as evidenced by an entry in Special:AbuseLog)
  4. Enable temporary accounts on your wiki
  5. While logged out attempt to create a temporary account and verify that the account creation matched the abuse filter
  6. Change the filter to be user_type = 'temp' (still set to log only)
  7. Make an edit using your temporary account and verify that the edit matched the abuse filter
  8. Change the filter to be user_type = 'named' (still set to log only)
  9. Log into an account and make an edit, then verify that the edit matched the abuse filter

@Dreamy_Jazz Filters work as designed as seen in the videos below. I do have a question on the potential issue. As you see in the video, I disabled "Temp" filter and left "IP" and "Name" on. I then edit with a temp account and it showed in the Filter log under the "IP" filter even though "Temp" filter is disabled . Is that ok?

Status: ✅ PASS
Environment: Local: .42.0-alpha (d91c1e7) 14:25, 12 March 2024
OS: macOS Sonoma 14.2.1
Browser: Chrome 122
Skins. Vector 2022
Device: MBA M2
Emulated Device:: n/a
Test Links:
https://en.m.wikipedia.beta.wmflabs.org/wiki/Cat#
Special:AbuseFilter
Special:AbuseLog

✅AC1: https://phabricator.wikimedia.org/T357615

IPTempName

❓Pending potential issue

Temp filter disable with temp account edit

@Dreamy_Jazz Filters work as designed as seen in the videos below. I do have a question on the potential issue. As you see in the video, I disabled "Temp" filter and left "IP" and "Name" on. I then edit with a temp account and it showed in the Filter log under the "IP" filter even though "Temp" filter is disabled . Is that ok?
....
❓Pending potential issue

Temp filter disable with temp account edit

This is the expected behaviour, as AbuseFilter is run before the temporary account is created for the user. This may change in T359405: Create temporary account early in edit cycle for all edit attempts (so that the value of this variable would be temp on an edit which causes the creation of a temporary account).

@Dreamy_Jazz Filters work as designed as seen in the videos below. I do have a question on the potential issue. As you see in the video, I disabled "Temp" filter and left "IP" and "Name" on. I then edit with a temp account and it showed in the Filter log under the "IP" filter even though "Temp" filter is disabled . Is that ok?
....
❓Pending potential issue

Temp filter disable with temp account edit

This is the expected behaviour, as AbuseFilter is run before the temporary account is created for the user. This may change in T359405: Create temporary account early in edit cycle for all edit attempts (so that the value of this variable would be temp on an edit which causes the creation of a temporary account).

Great, I will move this to Done. Thanks for the confirmation, steps, and all your work!