Page MenuHomePhabricator

Unable to remove manually applied tags used by edit filters
Open, Needs TriagePublicBUG REPORT

Description

Steps to reproduce:
Attempt to remove the repeating characters tag from revisions at https://www.mediawiki.org/w/index.php?title=MediaWiki&action=history (added by a vandal)

Expected result:
Can remove, since https://www.mediawiki.org/wiki/Special:Tags confirms that the tag can be Applied manually by users and bots (also applied automatically by the abuse filter though)

Actual result:
Cannot be removed - tags-update-remove-not-allowed-one is shown

Cause:

ChangeTags::canUpdateTags
if ( $tagsToRemove ) {
	// to be removed, a tag must not be defined by an extension, or equivalently it
	// has to be either explicitly defined or not defined at all
	// (assuming no edge case of a tag both explicitly-defined and extension-defined)
	$softwareDefinedTags = self::listSoftwareDefinedTags();
	$intersect = array_intersect( $tagsToRemove, $softwareDefinedTags );
	if ( $intersect ) {
		return self::restrictedTagError( 'tags-update-remove-not-allowed-one',
			'tags-update-remove-not-allowed-multi', $intersect );
	}
}

This assumption dates back to when the functionality was first introduced in T20670: Create ability to add / remove tags from edits / actions. Original code:

Original
// to be removed, a tag has to be either explicitly defined or not defined
// at all
$definedTags = self::listDefinedTags();
$diff = array_diff( $tagsToRemove, $explicitlyDefinedTags );
if ( $diff ) {
	$intersect = array_intersect( $diff, $definedTags );
	if ( $intersect ) {
		return self::restrictedTagError( 'tags-update-remove-not-allowed-one',
			'tags-update-remove-not-allowed-multi', $intersect );
	}
}

@TTO @Anomie this edge case appears to have emerged

Event Timeline

DannyS712 created this task.Mar 6 2020, 2:42 AM
Restricted Application added a project: User-DannyS712. · View Herald TranscriptMar 6 2020, 2:42 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
DannyS712 moved this task from Unsorted to Reports on the User-DannyS712 board.Mar 6 2020, 2:43 AM
DannyS712 moved this task from Backlog to Change tags on the AbuseFilter board.
Aklapper removed a subscriber: Anomie.Fri, Oct 16, 5:01 PM