Skip to content

Commit

Permalink
avoid CNAME uncloaking if a proxy is set
Browse files Browse the repository at this point in the history
  • Loading branch information
antonok-edm committed May 28, 2021
1 parent 57aaa58 commit fec927b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions browser/net/brave_ad_block_tp_network_delegate_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
#include "brave/grit/brave_generated_resources.h"
#include "chrome/browser/net/secure_dns_config.h"
#include "chrome/browser/net/system_network_context_manager.h"
#include "chrome/browser/profiles/profile.h"
#include "components/prefs/pref_service.h"
#include "components/proxy_config/proxy_config_dictionary.h"
#include "components/proxy_config/proxy_config_pref_names.h"
#include "components/proxy_config/proxy_prefs.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
Expand Down Expand Up @@ -246,6 +251,17 @@ void OnBeforeURLRequestAdBlockTP(const ResponseCallback& next_callback,
brave_shields::features::kBraveAdblockCnameUncloaking) &&
!ctx->browser_context->IsTor();

// Also, skip CNAME uncloaking if there is currently a configured proxy.
Profile* profile = Profile::FromBrowserContext(ctx->browser_context);
ProxyConfigDictionary dict(
profile->GetPrefs()->GetDictionary(proxy_config::prefs::kProxy)->Clone());
ProxyPrefs::ProxyMode mode;

if (!dict.GetMode(&mode) || !(mode == ProxyPrefs::ProxyMode::MODE_DIRECT ||
mode == ProxyPrefs::ProxyMode::MODE_SYSTEM)) {
should_check_uncloaked = false;
}

task_runner->PostTaskAndReplyWithResult(
FROM_HERE,
base::BindOnce(&ShouldBlockRequestOnTaskRunner, ctx, EngineFlags(),
Expand Down

0 comments on commit fec927b

Please sign in to comment.