Page MenuHomePhabricator

De-duplicate IP addresses in JS UsersMultiselectWidget
Closed, DeclinedPublic

Description

After T275394, one problem remains with IP addresses in the UsersMultiselectWidget: the JS widget allows the same address to be entered more than once, in different formats (e.g. ::1 and 0:0:0:0:0:0:0:1). If there is a limit set for the number of items that can be entered, both will count towards this limit.

They are de-duplicated in the PHP, however, so anything handling the widget's input will receive only unique IP addresses. Also the PHP version of the widget will respect the limits correctly.

From gerrit:

You would probably need to poke around the mw.widgets.UsersMultiselectWidget.prototype.updateMenuItems, which is where you can see the de-duping happening for the usernames as part of the API call, and add some kind of normalizing function there so that you have that IP to check against.

Event Timeline

As @STran points out, we've worked around not having an IP address normalizer method in the JS utils before (e.g. T267015). Might be worth thinking about adding one.

Tchanders renamed this task from De-duplicate IP addresses in JS UsersMultisleectWidget to De-duplicate IP addresses in JS UsersMultiselectWidget.Apr 1 2021, 6:42 PM
Dreamy_Jazz subscribed.

I don't think we need this given that:

  • No one has commented to say they have had this issue apply to them
  • I've not seen many people hit the limit of targets