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

Invalid $dnsrewrite rules should be discarded #2492

Closed
ameshkov opened this issue Dec 25, 2020 · 1 comment
Closed

Invalid $dnsrewrite rules should be discarded #2492

ameshkov opened this issue Dec 25, 2020 · 1 comment
Assignees
Milestone

Comments

@ameshkov
Copy link
Member

I've tried experimenting with $dnsrewrite and added an invalid rule:
||example.org^$dnsrewrite=A:NOERROR:127.0.0.1

The result was that the rule was applied, but the response was NXDOMAIN, which is unexpected.
Instead of that, I suggest simply discarding this kind of rules at the moment when they're parsed by urlfilter.

@ainar-g
Copy link
Contributor

ainar-g commented Dec 28, 2020

The thing that is happening is that the parser interprets your input as a shorthand form of a new CNAME, and so it returns the rewrite that tries to resolve the host A:NOERROR:127.0.0.1. That means we have to define what exactly makes a host valid and use that.

adguard pushed a commit to AdguardTeam/urlfilter that referenced this issue Dec 28, 2020
Merge in DNS/urlfilter from 2492-validate-dnsrw-host to master

Updates AdguardTeam/AdGuardHome#2492.

Squashed commit of the following:

commit bed4224
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 28 14:56:02 2020 +0300

    rules: improve $dnsrewrite shorthand cname validation
heyxkhoa pushed a commit to heyxkhoa/AdGuardHome that referenced this issue Mar 20, 2023
Merge in DNS/adguard-home from 2492-dnsrw-host to master

Closes AdguardTeam#2492.

Squashed commit of the following:

commit 7128ed1
Merge: e678c64 338209f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 28 18:42:25 2020 +0300

    Merge branch 'master' into 2492-dnsrw-host

commit e678c64
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 28 18:04:52 2020 +0300

    dnsfilter: improve cname rewrite validation
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

2 participants