Page MenuHomePhabricator

Special:AbuseFilter/history incorrectly highlighting unchanged flags when a filter is protected
Closed, ResolvedPublicBUG REPORT

Description

Whenever a field of a filter (excluding notes and filter contents) is changed, a table cell is highlighted on the Special:AbuseFilter/history page using the .mw-abusefilter-history-changed class. This class, applied by AbuseFilterHistoryPager, adds a pink-ish background to indicate that a specific field has changed.

However, when a filter is protected, this class is incorrectly applied to cells in the "flags" column for every subsequent edit after the protection flag is set, even when no flags have actually changed.

Steps to replicate the issue (include links if applicable):

  • Create a new filter with 'Details of this filter are hidden from users who cannot see protected variables' enabled (possible when using user_unnamed_ip)
  • Make several edits to the filter, modifying only the filter notes or contents (not the flags, title or actions)
  • Check the history of that filter.

What happens?:
Cells in the "flags" column are highlighted on every edit after the filter is protected, despite no actual change to flags.

What should have happened instead?:
Only cells for actually changed fields should be highlighted.

Other information (browser name/version, screenshots, etc.):
Firefox 139 on linux 6.12.26:

20250611_18h29m45s_grim.png (600×976 px, 136 KB)

Event Timeline

How fresh are the rows (days vs. months)?

How fresh are the rows (days vs. months)?

There are several days in between them, totalling for about 3 weeks.

Looking at some test filters on testwiki I also noticed a case where it starts highlighting these cells from as far back as October 2024 up to the present.

matej_suchanek triaged this task as High priority.EditedJun 14 2025, 11:38 AM

Seems that FilterCompare always returns af_hidden for these filters (which is then stored in afh_changed_fields).
As a consequence, when you make no changes to a protected filter, a new version gets saved.

Change #1157487 had a related patch set uploaded (by Matěj Suchánek; author: Matěj Suchánek):

[mediawiki/extensions/AbuseFilter@master] Copy protected flag prior to comparison

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

Change #1157487 merged by jenkins-bot:

[mediawiki/extensions/AbuseFilter@master] Copy protected flag prior to comparison

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

Djackson-ctr subscribed.

Using Beta wiki and Localhost for testing:
QA is completed, I have verified the new code has been implemented and is functioning as expected.

image.png (833×1 px, 125 KB)

image.png (948×1 px, 122 KB)

kostajh claimed this task.