Investigate rejecting too broad filters
Background
This come from Easylist issue https://github.com/easylist/easylist/issues/6123
A filter with a single letter (u
) was added to the filter list basically blocking any URL containing u
.
So we should investigate what is the minimum length of a generic filter to not be reject.
A few key item to consider:
- Check all Easylist to determine what the minimum relevant filter
- Interestingly the matcher, as an implementation detail, limit "keywords" to 3 chars. Keyword are continuous string of alpha-numerical values to classify filters for lookup purpose. It indicate to some extent what amount of information is considered.
What to change
Change filterClasses.js
to reject filters deemed too broad.
Integration Notes
This will introduce two new invalid filter reasons which may require associated UI messages:
- filter_url_not_specific_enough - when a generic URL filter's pattern is 3 characters or less
- filter_elemhide_not_specific_enough - when a generic elemhide, elemhide exception, or elemhide emulation filter's body is 2 characters or less
Testing notes
- Try to add a short generic filter, like
##p
oru
. - You should be unable to add this as a custom filter, since these are now invalid filters.
- This only applies to generic filters, so if you specify a domain,
u$domain=example.com
, then it is valid.
Edited by Justin Wernick