Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed and Dynamic-filtering:-precedence #527

Closed
ruy-benton opened this issue Jul 24, 2015 · 10 comments
Closed

Speed and Dynamic-filtering:-precedence #527

ruy-benton opened this issue Jul 24, 2015 · 10 comments

Comments

@ruy-benton
Copy link

In wiki, you describe for better security - enable:
3rd-party scripts and frames, inline and 1st-party scripts.

And there is another Benefit / Advantage - IT'S SPEED.
If uBlock (Dynamic-filter) blocks all that scripts and frames ... he don't search in static filters.



I analysed https://github.com/gorhill/uBlock/wiki/Dynamic-filtering:-precedence

If I block 3rd-party frames and scripts - red in "My rules",
why the local "www.example.com * * noop" don't disable this 3rd-party?

and this disable:
"www.example.com * 3p-script noop"
"www.example.com * 3p-frame noop"

Thank you in advance for your comments

@gorhill
Copy link
Owner

gorhill commented Jul 24, 2015

why the local "www.example.com * * noop" don't disable this 3rd-party?

I don't understand the issue report. What do you mean by "don't disable this 3rd-party"? www.example.com * * noop means to disable dynamic filtering for www.example.com.

@RoxKilly
Copy link

@ruy-benton noop means allow this request unless a static filter blocks it where static filters come from block lists in the 3rd Party Filters tab of UBlock's settings (EasyList and EasyPrivacy for example).

In dynamic filtering, site-specific rules will take precedence over more general rules. So even if you block 3rd party scripts generally, the site-specific rule www.example.com * * noop will override the block and allow 3rd party scripts made from www.example.com (except those scripts blocked by static filters)

@ruy-benton
Copy link
Author

Edit: Understand the concept and implementation of @gorhill and the comments in the end of this thread.

@RoxKilly

  1. I want that procedure ... correct
    And "Fanboy+Easylist-Merged Ultimate List‎", "Malware domains‎" ...

@RoxKilly
2) "... even if you block 3rd party scripts generally, the site-specific rule
'www.example.com * * noop' will override the block and allow 3rd party scripts made from www.example.com ..."

But ... for example http://www.ic.ac.uk

I block 3rd-party frames and scripts - red in "My rules",

In Logger:

....
10:11:04 image http://www.ic.ac.uk/NewsEvents/image/featurenews2012/28511.jpg
10:11:04 image http://www.ic.ac.uk/NewsEvents/image/featurenews2012/28512.jpg
10:11:04 * * 3p-script block -- script http://www.google-analytics.com/ga.js

Insert: www.ic.ac.uk * * noop

10:24:31 image http://www.ic.ac.uk/NewsEvents/image/featurenews2012/28511.jpg
10:24:31 image http://www.ic.ac.uk/NewsEvents/image/featurenews2012/28512.jpg
10:24:31 * * 3p-script block -- script http://www.google-analytics.com/ga.js

No change ...

Insert: www.ic.ac.uk * 3p-script noop

10:28:06 image http://www.ic.ac.uk/NewsEvents/image/featurenews2012/28511.jpg
10:28:06 image http://www.ic.ac.uk/NewsEvents/image/featurenews2012/28512.jpg
10:28:06 .com/ga.js -- script http://www.google-analytics.com/ga.js

Static filter in action

In some sites I want the local - 3p-script ... access ... I need the content of 3rd

Thank you for your work and comments,
Ruy

@gorhill
Copy link
Owner

gorhill commented Jul 25, 2015

"... the site-specific rule www.example.com * * noop will override the block and allow 3rd party scripts made from www.example.com ..."

Put in words, www.ic.ac.uk * * noop means you are noop'ing the all cell for site www.ic.ac.uk, which is usually pointless unless you have a block or allow rule for the global all cell.

The 3p-script cell has precedence over the all cell, hence the result:

All cells override the all cells. The local all cell overrides the global all cell.

https://github.com/gorhill/uBlock/wiki/Dynamic-filtering:-precedence.

The order of cells in the matrix offers a hint: the lower the cell, the higher precedence (and the more specific).

@gorhill gorhill closed this as completed Jul 25, 2015
@ruy-benton
Copy link
Author

Edit: Other users have the same comments ...

Another one:

@seanrand
...
"Edit: Just tried countering the * * 3p block with behind-the-scene * * noop, but it seems that 3p block takes precedence. Hmm.

Edit: behind-the-scene * 3p noop did the trick. Might be worth adding to the wiki."

@gorhill
Copy link
Owner

gorhill commented Jul 25, 2015

I don't' understand why you close the issue

Because there is no issue with uBlock, what you think is an issue is exactly how the precedence is documented.

@seanrand
Copy link
Contributor

Trying to understand why I'm being quoted here, my comment was just me figuring out the precedences (which gorhill explained in this issue before closing it), sorry if that caused any confusion.

@ruy-benton
Copy link
Author

It's very simple ... if you post or I can insert some images in WIKI.

When I change "www.ic.ac.uk * 3p-script noop" ( in "3rd-party scripts" right ) -> "www.ic.ac.uk * * noop"
uBlock move to "all" ( local ).

@seanrand
Copy link
Contributor

@ruy-benton, I don't want to derail #528 any further, so I'm commenting here. I think I see where the confusion might stem from.

Let's take this page as an example. We are using default-deny (* * 3p-frame block and * * 3p-script block) and apply github.com * * noop:

screenshot-20150726t013907

When you look at the matrix, you could think that github * * noop overrides the * * 3p-frame block and * * 3p-script block rules because all hosts are greyed out. But, as we learnt earlier, that actually isn't the case! With this setup, github * * noop does not noop third-party scripts and frames.

A better representation of the situation would be this:

screenshot-20150726t013907_y

Some third-party assets such as images and css are allowed (because there is no github * 3p deny or github * 3p-passive deny rule) while others (scripts, frames) are still blocked.


Similarly, nooping third-party scripts locally on a default-deny setup is currently represented like this in the matrix:

screenshot-20150726t011623

It's not immediately obvious that some third-party requests are still being blocked (frames). This could be represented more accurately like this:

screenshot-20150726t011623_y


@gorhill, are you following? You're already using a yellow indicator for "mixed" (some requests blocked, some allowed) in the first column of the matrix, so applying it to the second and third column would be intuitive and more accurately represent the state of dynamic filtering for a host.


For completeness, another (more realistic) example:

screenshot-20150726t023055
screenshot-20150726t023138

This situation is even more inconsistent, as third-party images/css are nooped and third-party scripts/frames are blocked in both cases. (I hope I'm correct - I'm not very familiar with 3p-passive yet, please correct me if I'm wrong)
Yet when you look at the matrix, the third-party hosts could be interpreted as blocked in the first case or nooped in the second case.

Both would be better represented by this:

screenshot-20150726t023055_y
and this, respectively:
screenshot-20150726t023138_y

@ruy-benton
Copy link
Author

@seanrand translated my text -> images !!!!! Wowwwwwwwwwwwwwwwwwwww

I understand @gorhill in 2 comment and write:


When I change "www.ic.ac.uk * 3p-script noop" local ( in "3rd-party scripts" right ) -> "www.ic.ac.uk * * noop"
uBlock move to "all" ( local ).


and try to help you in #528

Please update WIKI with images and this will help other users.

Thank you very much for your great software

seanrand added a commit to seanrand/uBlock that referenced this issue Oct 28, 2015
This is a quick demonstration of how inconsistencies
caused by conflicting dynamic block/allow rules in the
dynamic blocking matrix could be handled. A yellow-ish
indicator is added to cells that are affected by more
than one conflicting dynamic filtering rule.

For example if 3p deny and 3p-scripts or 3p-frames allow/noop
are selected, the current way of shading 3p cells red/gray
does not accurately reflect the mixed state for those cells.
For first-party cells, inline-script and 1p-script are affected.
The display of image and all rules hasn't been changed.

This is based on the idea outlined in my comment
gorhill#527 (comment)
refer to that for screenshots and further examples.

gorhill#544
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants