TechnikEmpire / HttpFilteringEngine

Transparent filtering TLS proxy.
Mozilla Public License 2.0
60 stars 33 forks source link

Replace Adblock Plus filter syntax #91

Closed TechnikEmpire closed 7 years ago

TechnikEmpire commented 8 years ago

In the very near future, as soon as I have free time, completely get rid of ABP filter syntax. They're convoluted and counter-intuitive. ABP CSS filters are fine because they're not even anything special to ABP, they're just plain old CSS selectors. The filter syntax is horrible though. Replace it and make an external converter to enable porting over ABP styled rules.

Example:

||some-specific-domain/some/path^arg$domain=some-other-domain.com

Oh look, it's an anchored domain! Simple enough, I just need to parse the URI and expect that the first part of my request (the domain) matches or doesn't match the extracted host. No problem. The $third-party or $~third-party flags are not set at all, so yep, just gonna look at this request we don't care if it's third party.

Oh wait, the $domain= or $domain~= flag is specified. Darn it, well that would make this rule exclusively also a $third-party or $~third-party rule also! But wait, that means there's two flags that entirely overlap eachother, well maybe, depends on the values of one or more of those flags. Okay still got this. So oh yeah gee now I need to extract the Referer field and index based on this, then in matching I need to parse and compare against both the HOST and REFERER URI's, then check........ wait, did we parse and compare the specified inclusion and or exception domains against the actual anchored domain???!?!?!.............

They're garbage. The idea of a simple subset of regex was great, the implementation was a disaster. Replace the format.

TechnikEmpire commented 7 years ago

No longer an issue now that filtering is externalized.