Skip to content

Loading…

Expand extended syntax [Important] #1395

Open
davidhedlund opened this Issue · 36 comments

6 participants

@davidhedlund

List of Local uBlock dynamic filtering

  • all: github.com * * block
  • images: github.com * image block
  • 3rd-party: github.com * 3p block
  • inline scripts: github.com * inline-script block
  • 1st-party scripts: github.com * 1p-script block
  • 3rd-party scripts: github.com * 3p-script block
  • 3rd-party frames: github.com * 3p-frame block

List of Global uBlock dynamic filtering

  • all: * * * block
  • images: * * image block
  • 3rd-party: * * 3p block
  • inline scripts: * * inline-script block
  • 1st-party scripts: * * 1p-script block
  • 3rd-party scripts: * * 3p-script block
  • 3rd-party frames: * * 3p-frame block

List of Local uBlock dynamic filtering translated to static filters

  • all: *$domain=github.com
  • images: ||github.com^$image
  • 3rd-party: ||github.com^$third-party
  • inline scripts: ||github.com^$inline-script
  • 1st-party scripts: ||github.com^$script
  • 3rd-party scripts: ||github.com^$third-party,script
  • 3rd-party frames: ||github.com^$subdocument

List of Global uBlock dynamic filtering translated to static filters

  • all: $domain=*
  • images: $domain=*^$image
  • 3rd-party: $domain=*^$third-party
  • inline scripts: $domain=*^$inline-script
  • 1st-party scripts: $domain=*^$script
  • 3rd-party scripts: $domain=*^$third-party,script
  • 3rd-party frames: $domain=*^$subdocument

Missing:

  • noop

Further reading

@davidhedlund davidhedlund changed the title from What is the equivalent filter for blocking all local to What is the equivalent filter for blocking all local?
@davidhedlund davidhedlund changed the title from What is the equivalent filter for blocking all local? to Help with rule-like filter
@davidhedlund davidhedlund changed the title from Help with rule-like filter to Important: Add noop to extended syntax
@davidhedlund davidhedlund changed the title from Important: Add noop to extended syntax to Important: Add "noop" and "all" to extended syntax
@davidhedlund davidhedlund changed the title from Important: Add "noop" and "all" to extended syntax to Important: Expand extended syntax
@Snapy

Try this ABP page for filter syntax.

@chrisaljoudi

@davidhedlund The dynamic filtering rules are handled differently from the "static net filtering" (which is what the ABP filter syntax specifies).

Check out the "My Rules" tab in uBlock's preferences to see the textual representation of the dynamic filtering rules.

@davidhedlund

@chrisaljoudi It is possible to write

||google-analytics.com^$important,third-party
but not
||google-analytics.com^$important,third-party
--gstatic.com^$important,third-party

gstatic might be a third-party of google-analytics.com. say that "--" above means "noop" which in that example will let gstatic.com to use static net filtering instead of being blocked.

@davidhedlund

@chrisaljoudi The reason why I want to write rule-like filters is because I want people to have the possibility to subscribe to them. That's not possible with rules, right?

@chrisaljoudi

@davidhedlund right, it's currently not possible to import/subscribe to external dynamic filtering rules.

In your example, though, I'm a bit confused.

This filter:

||google-analytics.com^$important,third-party

does not affect gstatic.com. Why would you need to "noop" gstatic.com then?

@davidhedlund

@chrisaljoudi That was just a (bad) example. Please refer to the screenshot in the top of this post. Would it hurt to add "noop" to the extended syntax?

As I see it everything should be in "My filters" (static and dynamic filters). Its simpler that way and there's not really any reason to keep My Rules if you add the requested syntax above.

@chrisaljoudi

@davidhedlund It's not that it would hurt, I just don't understand what it means.

Let's say we have the following (I used the -- syntax you used as an example):

||google.com^$script
--googleAnalyticsScript.js$script
*AnalyticsScript.js$script

Would google.com/googleAnalyticsScript.js be blocked or not (in the final result)?

@chrisaljoudi

@davidhedlund Let me see if I can communicate this better:

noop makes sense in dynamic filtering because dynamic filtering occurs as a step before static net filtering. So it just means: "okay, let it through to the second step [which is static net filtering]".

noop doesn't make sense in the context of static net filtering because there are no steps after that.

In other words, by the end of the static net filtering step, one must have either an allow or a block, not a noop.

@davidhedlund

@chrisaljoudi I suggest that you add noop syntax that can be used to write filter. Just make uBlock to start by only execute dynamic filters (like noop) and then start over again to only execute static filters.

I hope I'm clear enough even if my native language is Swedish. Do you understand me?

@chrisaljoudi

@davidhedlund I'm sorry, I'm afraid I don't.

How does a noop filter in static net filtering (as I understand it from your description) differ from an exception filter?

@davidhedlund

@chrisaljoudi I suggested that noop (!! might be better as Adblock Plus will read ! as comment), global, and all, can be added to My filters. The title for filters is My filters not My static filters, so there is room to expand that section to use dynamic filters too.

1: I suggest that you change the My rules syntax to filter-based syntax, example: Changing www.domain.tld * noop to !!domain.tld. It's a win-win even if you decide to stay here and not want to proceed with the next step.
2: Merge My rules to My filters and remove My rules. Then make sure that uBlock uses My filters by executing dynamic filters before static filters.

@davidhedlund

List of uBlock dynamic filtering translated to static filters

  • all: ||domain.tld^ <--------------------------------- Correct?
  • images: ||domain.tld^$image
  • 3rd-party: ||domain.tld^$third-party
  • inline scripts: ||domain.tld^$inline-script
  • 1st-party scripts: ||domain.tld^$script
  • 3rd-party scripts: ||domain.tld^$third-party,script
  • 3rd-party frames: ||domain.tld^$subdocument
@chrisaljoudi

@davidhedlund I get what you're saying now.

I'll have to give this some thought, because it breaks default-deny in some ways.

@davidhedlund

@chrisaljoudi Is all: ||domain.tld^ <--------------------------------- Correct?

@chrisaljoudi

@davidhedlund nope. More like:

*$domain=domain.tld
@davidhedlund

@chrisaljoudi Thank you! I added that to the top of the post as reference.

@chrisaljoudi

@davidhedlund I believe so; that would block all requests when on a page from the domain fsf.org.

@davidhedlund

@chrisaljoudi This is good. I removed the "all" problem from this post.

@davidhedlund

@chrisaljoudi What about global?

@chrisaljoudi

@davidhedlund what about "global"? What's an example?

@davidhedlund

@chrisaljoudi *$domain=github.com is for "all local", how would that be written for "all global"?

@chrisaljoudi

@davidhedlund if you mean matching every request globally:

*
@davidhedlund

@chrisaljoudi so ||* blocks everything?

@chrisaljoudi

@davidhedlund * matches everything, yes.

@davidhedlund

@chrisaljoudi To take a better example:

Local: ||github.com^$third-party,script
Global: ||*^$third-party,script

Is Global written correct?

@chrisaljoudi

@davidhedlund it would be:

*$third-party,script
@davidhedlund

@chrisaljoudi Perhaps we want to replace ||twitter.com^$important,third-party with *$important,third-party and explain that it is equivalent to global block of 3rd-party scripts in https://github.com/chrisaljoudi/uBlock/wiki/Filter-syntax-extensions#extended-syntax

What do you think about it?

@davidhedlund

@chrisaljoudi all local for github.com is *$domain=github.com. Is all global equivalent to $domain=*?

@chrisaljoudi

@davidhedlund yes, but $domain=* is just like not having it at all.

@davidhedlund

@chrisaljoudi when I add $domain=* (or *$domain=*) I can see everything in fsf.org but when I select all global less content of the page is showed to me. This means that the static filters $domain=* or *$domain=* is not equivalent to the dynamic filter * * * block (all global).

@davidhedlund

@chrisaljoudi Please help me proof-read these lists:

List of Local uBlock dynamic filtering

  • all: github.com * * block
  • images: github.com * image block
  • 3rd-party: github.com * 3p block
  • inline scripts: github.com * inline-script block
  • 1st-party scripts: github.com * 1p-script block
  • 3rd-party scripts: github.com * 3p-script block
  • 3rd-party frames: github.com * 3p-frame block

List of Global uBlock dynamic filtering

  • all: * * * block
  • images: * * image block
  • 3rd-party: * * 3p block
  • inline scripts: * * inline-script block
  • 1st-party scripts: * * 1p-script block
  • 3rd-party scripts: * * 3p-script block
  • 3rd-party frames: * * 3p-frame block

List of Local uBlock dynamic filtering translated to static filters

  • all: *$domain=github.com
  • images: *$domain=github.com,image
  • 3rd-party: *$domain=github.com,third-party
  • inline scripts: *$domain=github.com,inline-script
  • 1st-party scripts: *$domain=github.com,script
  • 3rd-party scripts: *$domain=github.com,third-party,script
  • 3rd-party frames: *$domain=github.com,subdocument

List of Global uBlock dynamic filtering translated to static filters

  • all: $domain=*
  • images: *$image
  • 3rd-party: *$third-party
  • inline scripts: *$inline-script
  • 1st-party scripts: *$script
  • 3rd-party scripts: *$third-party,script
  • 3rd-party frames: *$subdocument
@gwarser

I think these should be rewritten:

images: ||github.com^$image
3rd-party: ||github.com^$third-party
3rd-party scripts: ||github.com^$third-party,script
3rd-party frames: ||github.com^$subdocument

in this format:

*$domain=github.com,image
...

because you don't want to block github.com/images.jpg but all images when browsing github.com

not sure about this:

inline scripts: ||github.com^$inline-script

and this:

1st-party scripts: ||github.com^$script

but might be

||github.com^$domain=github.com,script
or
||github.com^$~third-party,script

because you want to block scripts from github when you are on github

@seanrand

Sorry, I don't understand the point of this exercise. Why are you trying to rewrite dynamic filtering rules as static filtering rules in the first place?

If

because I want people to have the possibility to subscribe to them

is the only reason, wouldn't it make more sense to define a format for sharing dynamic filter lists and adding a way to subscribe to them similar to the static 3rd party filters?

[uBlock xx]
! Title: Example of a uBlock dynamic filter subscription file
! Last modified: 19 May 2015 19:11 UTC
! Expires: 4 days (update frequency)
* * 3p-frame block
* * 3p-script block
wikipedia.org wikimedia.org * noop
www.dropbox.com dropboxstatic.com * noop
www.facebook.com akamaihd.net * noop
! etc etc etc

And if that's the only reason, I doubt that being able to subscribe to dynamic filtering rules would be very useful anyway.

For people who use default-deny, the dynamic filters are mostly a very short, personal selection of frequently visited sites. You'd have a lot of maintenance overhead to provide people with a dynamic filtering list to subscribe to that includes all their favourite websites in order to be of any use to them.

@davidhedlund davidhedlund changed the title from Important: Expand extended syntax to Expand extended syntax [Important]
@davidhedlund

@chrisaljoudi Can you please validate the current list #1395 (comment)?

@hotdogman

It's worth noting that you can create static filters from the logger in uBlock Origin now.
https://github.com/gorhill/uBlock/releases - See 0.9.8.7
gorhill/uBlock@48f47a6
gorhill/uBlock@91cb61c
gorhill/uBlock@056a760

@flyingzebras flyingzebras referenced this issue in gorhill/uBlock
Closed

How to make dynamic filters static? #1063

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.