Skip to content

Commit

Permalink
Merge pull request #7909 from brave/pr7769_tor-dns-leak_1.21.x
Browse files Browse the repository at this point in the history
Fix Tor dns leak (uplift to 1.21.x)
  • Loading branch information
kjozwiak authored and bbondy committed Feb 19, 2021
1 parent 17a1316 commit da2fa9e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 2 additions & 4 deletions browser/net/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ source_set("net") {
"//brave/components/brave_webtorrent/browser/buildflags",
"//brave/components/ipfs/buildflags",
"//brave/extensions:common",
"//components/content_settings/core/browser",
"//components/prefs",
"//components/user_prefs",
"//content/public/browser",
"//content/public/common",
"//components/content_settings/core/browser",
"//extensions/common:common_constants",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/system",
Expand Down Expand Up @@ -88,9 +88,7 @@ source_set("net") {
"brave_referrals_network_delegate_helper.h",
]

deps += [
"//brave/components/brave_referrals/browser",
]
deps += [ "//brave/components/brave_referrals/browser" ]
}

if (enable_brave_webtorrent) {
Expand Down
11 changes: 10 additions & 1 deletion browser/net/brave_ad_block_tp_network_delegate_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,16 @@ void OnBeforeURLRequestAdBlockTP(const ResponseCallback& next_callback,
scoped_refptr<base::SequencedTaskRunner> task_runner =
g_brave_browser_process->ad_block_service()->GetTaskRunner();

new AdblockCnameResolveHostClient(std::move(next_callback), task_runner, ctx);
DCHECK(ctx->browser_context);
// DoH or standard DNS quries won't be routed through Tor, so we need to skip
// it.
if (ctx->browser_context->IsTor()) {
ShouldBlockAdWithOptionalCname(task_runner, std::move(next_callback), ctx,
base::nullopt);
} else {
new AdblockCnameResolveHostClient(std::move(next_callback), task_runner,
ctx);
}
}

int OnBeforeURLRequest_AdBlockTPPreWork(const ResponseCallback& next_callback,
Expand Down

0 comments on commit da2fa9e

Please sign in to comment.