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

Add support for uBO's new "$cname" feature #1570

Closed
3 tasks done
DandelionSprout opened this issue Apr 11, 2020 · 6 comments
Closed
3 tasks done

Add support for uBO's new "$cname" feature #1570

DandelionSprout opened this issue Apr 11, 2020 · 6 comments
Assignees
Labels

Comments

@DandelionSprout
Copy link
Member

DandelionSprout commented Apr 11, 2020

Prerequisites

Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • I am running the latest version (v0.101.0)
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Problem Description

Long story short: uBlock Origin introduced $cname in 1.25.3, which took me wildly by surprise as I thought I'd suggest they could create such a qualifier. But nevertheless, it seems like a pretty good fit for AdGuard Home that also serves an actual unique purpose, of ensuring that domains are only blocked through their URL address or their CNAME responses, instead of both.

That being said, their current implementation is whitelisting-only, for whatever reason. I see no immediate reason for why using $cname to only block by CNAME responses can't be done.

Proposed Solution

Add support for $cname to block based on CNAME only, and $~cname to block based on the main URL only.

Alternatives Considered

Add support for @@ + $cname in much the same way the uBO team did it; or maybe even convince the uBO team to give $cname the ability to block things. Either way to ensure cross-extension support.

Additional Information

Had I known any earlier about uBO adding it, I'd have submitted this feature request several weeks ago... 😬

@DandelionSprout DandelionSprout changed the title Add support for uBO's new "$cname" / "$~cname" feature Add support for uBO's new "$cname" feature Apr 11, 2020
@ameshkov ameshkov added this to the v0.103 milestone Apr 13, 2020
@ameshkov ameshkov self-assigned this Apr 13, 2020
@ameshkov
Copy link
Member

I see no immediate reason for why using $cname to only block by CNAME responses can't be done.

Agreed

@ameshkov ameshkov modified the milestones: v0.103, v0.104 Jun 22, 2020
@ameshkov ameshkov assigned szolin and unassigned ameshkov Sep 14, 2020
@ameshkov
Copy link
Member

I am starting to think that $cname name might be misleading. AdGuard does not limit itself to CNAME scanning, it also checks A and AAAA responses so it's able to block domains by IP address.

Therefore, I suppose we should name this modifier $dnsresponse so that it was clear. $cname may be an alias kept just for compatibility.

I am also thinking about introducing a $dnstype modifier that would allow targeting specific DNS queries by type. For instance, ||example.org^$dnstype=A or ||example.org^$dnstype=TXT. It may be useful in conjunction with $dnsrewrite.

Also, I have to reassign this task to v0.105 as I don't have enough time to take care of it before v0.104 is released.

@ameshkov ameshkov modified the milestones: v0.104, v0.105 Sep 16, 2020
@gwarser
Copy link

gwarser commented Sep 16, 2020

That being said, their current implementation is whitelisting-only, for whatever reason. I see no immediate reason for why using $cname to only block by CNAME responses can't be done.

It's implemented like generichide. It stops blocking CNAME resolved requests for specified document. Not for specified request by itself.

@ameshkov
Copy link
Member

This makes little sense to me. DNS replies are cached by the browser, and if it's blocked once for any website, it will be blocked on other websites regardless of any $cname exclusions.

@ameshkov
Copy link
Member

Actually, this can be avoided if the domain name is resolved with bypass_cache. Although, there would be some other complications due to that if we want to avoid making unnecessary DNS queries.

Anyways, according to @gwarser's description, uBO's $cname is quite different from what @DandelionSprout requested and we simply cannot implement it that way in AdGuard Home.

@ameshkov
Copy link
Member

Opened two separate tasks: $dnsrewrite and $dnstype:

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

No branches or pull requests

4 participants