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

Support Unstoppable Domains via DNS over HTTPS behind a feature flag #7702

Merged
merged 11 commits into from
Mar 3, 2021

Conversation

yrliou
Copy link
Member

@yrliou yrliou commented Jan 26, 2021

This PR adds support of Unstoppable Domains via public DoH endpoint https://resolver.unstoppable.io/dns-query provided by Unstoppable Domains, which currently is just a redirect to Cloudflare server https://eth.resolver.cloudflare-eth.com/dns-query without any logging.

This endpoint will only be used for name resolution if user set the resolve method to Public DNS over HTTPS server, and it will only be used for name resolution of domains ended with .crypto. The way we achieve this in the PR is hooking in where chromium updates the secure dns configuration in network service, add the custom servers if pref is set to public DoH. These added custom servers will be skipped for non-crypto domains before making actual DNS attempt in DNS transactions.

An interstitial page will be shown to users to opt in when users try to load *.crypto domains.
Screen Shot 2021-02-10 at 8 56 49 AM

New setting for resolve method is added:
Screen Shot 2021-02-10 at 9 25 34 AM

Resolves brave/brave-browser#14099

Submitter Checklist:

  • There is a ticket for my issue.
  • Used Github auto-closing keywords in the commit message.
  • Wrote a good PR/commit description
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed).
  • Requested a security/privacy review as needed.

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

  1. Open Brave and visit brave.crypto, it should show error page saying This site can’t be reached.

Screen Shot 2021-02-10 at 8 53 59 AM

  1. Go to settings, search for unstoppable, there should be no unstoppable domains resolve method setting.

  2. Go to brave://flags and search for unstoppable and enable the feature flag.

Screen Shot 2021-02-10 at 8 54 09 AM

  1. Restart browser and go to brave.crypto should now should the interstitial for users to opt-in unstoppable domains support.

Screen Shot 2021-02-10 at 8 56 49 AM

  1. Click Disable, should now see site can't be reached and Method to resolve unstoppable domains in brave://settings should now be Disabled.

  2. Change the resolve method setting back to ask and visit brave.crypto again.

Screen Shot 2021-01-26 at 9 27 03 PM

  1. Opt-in interstitial should be shown again, and this time click Proceed.

  2. Page should be loaded now. (Note that there will be a brief moment that it is showing site is not reached while the page is loading, this is a known and will be addressed in a new issue.)

  3. Method to resolve unstoppable domains in brave://settings should now be Public DNS over HTTP server.

  4. Open a new tab and visit brad.crypto, page should be loaded normally without any interstitial pages.

@yrliou yrliou self-assigned this Jan 26, 2021
@yrliou yrliou force-pushed the unstoppable_domains branch 7 times, most recently from dc11193 to 6b4853e Compare February 2, 2021 06:20
@yrliou yrliou force-pushed the unstoppable_domains branch 5 times, most recently from 9b1c406 to 8f0651f Compare February 4, 2021 17:53
@yrliou yrliou force-pushed the unstoppable_domains branch 4 times, most recently from 256ced6 to 5cff9ce Compare February 10, 2021 17:23
"//net/*",
"//services/network/*",
]
+ friend += brave_dns_friend
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add our test target as friend to these targets otherwise it will fail the gn_check for dns_transaction_unittest.cc

DCHECK(secure_);

size_t doh_server_index = dns_server_iterator_->GetNextAttemptIndex();
+ BRAVE_MAKE_HTTP_ATTEMPT
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to skip the DoH server we added for non-target TLDs (ex: non-crypto domains) when doing name resolution.

@yrliou yrliou force-pushed the unstoppable_domains branch 2 times, most recently from 550b2ee to 43fa128 Compare February 10, 2021 22:42
@yrliou yrliou added this to the 1.22.x - Nightly milestone Feb 10, 2021
@yrliou yrliou changed the title [WIP] UD Support Unstoppable Domains via DNS over HTTPS Feb 10, 2021
@yrliou yrliou marked this pull request as ready for review February 10, 2021 22:50
@yrliou yrliou requested review from bridiver and a team as code owners February 10, 2021 22:50
@yrliou yrliou requested a review from bbondy February 10, 2021 22:51
@yrliou yrliou force-pushed the unstoppable_domains branch from 43fa128 to e29bfde Compare February 10, 2021 22:52
@@ -20,7 +20,19 @@ Polymer({
showRestartToast_: Boolean,
torEnabled_: Boolean,
widevineEnabled_: Boolean,
disableTorOption_: Boolean
disableTorOption_: Boolean,
udEnabled_: Boolean,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't abbreviate, it makes it much harder to find things when searching.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7b47bd1

@yrliou yrliou force-pushed the unstoppable_domains branch from cb6294d to fbe1607 Compare March 2, 2021 00:33
@yrliou yrliou force-pushed the unstoppable_domains branch from 11a3365 to 5446cc6 Compare March 2, 2021 23:09
- Do not abbreviate unstoppable domains in brave_default_extensions_page
- Add comment to stub_resolver_config_reader override
- Separate Brave's own DnsTransaction unit tests
- Remove patch of stub_resolver_config_reader.cc and settings_secure_dns_handler.cc
- Update test
- Move browser/unstoppable_domains into its own target
@yrliou yrliou force-pushed the unstoppable_domains branch 2 times, most recently from 5cac257 to b612d3c Compare March 3, 2021 05:15
Before we were overriding SplitGroup and we will miss adding our DoH resolver
if doh_templates is empty.
@yrliou yrliou force-pushed the unstoppable_domains branch from b612d3c to c3fc742 Compare March 3, 2021 05:19
…nfig_reader.cc

Add it back due to chromium_src override has duplicate codes which is risky.
@yrliou
Copy link
Member Author

yrliou commented Mar 3, 2021

CI has post-init failures only which are due to vulnerabilities found by audit_deps and unrelated to this PR, merging.

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

Successfully merging this pull request may close these issues.

Support Unstoppable Domains via DoH behind a feature flag
4 participants