Opened on 09/20/2016 at 05:42:38 PM

Closed on 10/06/2016 at 09:53:45 AM

Last modified on 10/07/2016 at 10:09:34 AM

#4450 closed change (fixed)

Prevent ElemHide filters from being created with an empty domain restriction

Reported by: kzar Assignee: kzar
Priority: Unknown Milestone:
Module: Core Keywords:
Cc: trev, sebastian Blocked By: #4501
Blocking: #524 Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29356018/

Description (last modified by kzar)

Background

Element hiding filters can optionally be restricted to a domain, for example example.com##selector. They can even be restricted to multiple domains for example example.com,anotherexample.com##selector.

Currently filters can be restricted to an empty string domain too, empty domains are simply ignored. Meaning there can be multiple different filters which apply the same selector to all domains unconditionally, which makes the elemHide logic and data structures more complex.

What to change

Modify lib/filterClasses.js so that if an element hiding filter is created with any empty string domain restrictions it results in an InvalidFilter instance. Some examples of bad filters that should now result in InvalidFilter:

  • ,##selector
  • ,,,##selector
  • ~,example.com##selector

Simplify lib/elemHide.js so that filterKeysBySelector becomes filterKeyBySelector.

Attachments (0)

Change History (7)

comment:1 Changed on 09/21/2016 at 04:34:39 PM by kzar

I'm not sure about the best approach to take here since we currently don't parse the domains until they are accessed. Perhaps we should modify the ActiveFilter constructor to check for empty domains?

comment:2 Changed on 10/04/2016 at 08:22:38 PM by kzar

  • Owner set to kzar

comment:3 Changed on 10/05/2016 at 02:32:01 PM by kzar

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:4 Changed on 10/06/2016 at 09:50:05 AM by abpbot

A commit referencing this issue has landed:
Issue 4450 - Prevent ElemHide filters with empty domains

comment:5 Changed on 10/06/2016 at 09:53:45 AM by kzar

  • Description modified (diff)
  • Ready set
  • Resolution set to fixed
  • Status changed from reviewing to closed
  • Summary changed from Prevent filters from being created with an empty domain restriction to Prevent ElemHide filters from being created with an empty domain restriction

comment:6 Changed on 10/06/2016 at 11:24:17 AM by trev

  • Blocking 524 added

comment:7 Changed on 10/07/2016 at 10:09:34 AM by trev

  • Blocked By 4501 added

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from kzar.
 
Note: See TracTickets for help on using tickets.