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

Some rules with $document modifier work incorrectly #1421

Closed
AdamWr opened this issue Mar 5, 2021 · 11 comments
Closed

Some rules with $document modifier work incorrectly #1421

AdamWr opened this issue Mar 5, 2021 · 11 comments

Comments

@AdamWr
Copy link
Member

AdamWr commented Mar 5, 2021

I'm not sure if it's a bug or just CoreLibs limitation.

Steps to reproduce

  1. Add this rule:
    ||reddit.*^$document,domain=~reddit.com
  2. Go here - https://duckduckgo.com/?q=site%3Areddit.com&ia=web
  3. Open/Click on any link

Expected behavior

Website shouldn't be blocked.

Actual behavior

Website is blocked and if I refresh website then it's not blocked anymore.

Screenshot:

image

It's also not blocked if I open it directly - https://www.reddit.com/

Your environment

  • AdGuard for Windows version 7.6 nightly 22 (build 3500, CL 1.7.202)
@sxgunchenko
Copy link

sxgunchenko commented Mar 10, 2021

Hm... In which browser do you check it?
It seems like firefox and chrome act differently: FF sets the referrer to https://reddit.com/, but chrome sets it to https://duckduckgo.com/.
As a result, I can reproduce it in chrome, but cannot in FF.
In both cases the behavior is correct.
image
image

@AdamWr
Copy link
Member Author

AdamWr commented Mar 10, 2021

In which browser do you check it?

In Chrome.

Screenshot

image

If request URL is excluded in a rule (I mean domain=~reddit.com), shouldn't it be unblocked anyway?
If not, then as far as I understand it's CoreLibs limitation, with Chrome extension it works fine and website is not blocked.

@sxgunchenko
Copy link

sxgunchenko commented Mar 10, 2021

The logic of matching rules with the $domain modifier was slightly different in CL 1.7.202. A request with the document resource type matches against a rule with the $domain modifier if its referrer or target host matches against the modifier.

In this case, the referrer (duckduckgo.com) matches against the modifier (~reddit.com).

UPD: as for exclusions in the $domain modifier, a rule does not match if the referrer is excluded, but not the target domain

@sxgunchenko
Copy link

See #1354 (comment) for the upcoming changes

@sxgunchenko
Copy link

sxgunchenko commented Mar 19, 2021

Yup, it seems like I need the example.

Tried some combinations of target and referrer and it works as expected (target = t, referrer = r) :
t = http://advertisement.com/some, r = http://example.com => blocked as rule's pattern matches the target
t = http://advertisement.com/some, r = http://advertisement.solutions.zalando.com => not matched as the referrer is explicitly excluded
t = http://advertisement.solutions.zalando.com/some, r = http://advertisement.com => blocked as the pattern matches the target (see my previous comment #1421 (comment) about target exclusion)

@krystian3w
Copy link

@AdamWr
Copy link
Member Author

AdamWr commented Jan 3, 2022

It seems that now, rule like this:

||reddit.*^$document,domain=~reddit.com

blocks reddit.com, but I think that it shouldn't be blocked.

Steps to reproduce

  1. Add this rule:
||reddit.*^$document,domain=~reddit.com
  1. Go to - https://www.reddit.com/
Screenshot

image

reddit.com shouldn't be blocked.

AdGuard for Windows version 7.9 nightly 3 (build 3789, CL 1.8.279)

@AdamWr AdamWr reopened this Jan 3, 2022
@krystian3w
Copy link

krystian3w commented Jan 3, 2022

Also uBo started mark *^ in that filters as no needed due ^ no protect(/exclude scan) path after TLD/ or TLD./.

@Alex-302
Copy link
Member

Alex-302 commented Jan 3, 2022

@krystian3w *^ parsed as TLD only?

@krystian3w
Copy link

krystian3w commented Jan 3, 2022

uBo use gray color in highlighter, so filter writters can remove this form projects.

obraz
semi Hi-DPI screenshot

IMO nice will be implement enforce limit to tld for .*^ instead only mark as no power syntax - now may possible by regex only in uBo:

/^https?:\/\/([\w]{1,4}\.)?reddit\.[\w]{2,14}/$all,domain=~reddit.com

But page may use many subdomains like:

very.bad.gaga.reddit.angency to omit my regex or tld with 15 characters (maybe possible add safe . to allowed searched charactes without high CPU useage).

@sxgunchenko
Copy link

It seems that now, rule like this:

||reddit.*^$document,domain=~reddit.com

blocks reddit.com, but I think that it shouldn't be blocked.

Steps to reproduce

1. Add this rule:
||reddit.*^$document,domain=~reddit.com
2. Go to - https://www.reddit.com/

Screenshot

reddit.com shouldn't be blocked.

AdGuard for Windows version 7.9 nightly 3 (build 3789, CL 1.8.279)

Moved into a separate issue: #1579

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

6 participants