Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
do not allow any loading of brave:// urls from anywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
bridiver committed Aug 3, 2018
1 parent ef4292b commit dddf8d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions brave/browser/brave_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -860,9 +860,18 @@ void BraveContentBrowserClient::GetAdditionalWebUISchemes(
additional_schemes->push_back(content::kChromeDevToolsScheme);
}

bool BraveContentBrowserClient::CanCommitURL(
content::RenderProcessHost* process_host, const GURL& url) {
if (url.SchemeIs("brave"))
return false;
return true;
}

bool BraveContentBrowserClient::ShouldAllowOpenURL(
content::SiteInstance* site_instance, const GURL& url) {
GURL from_url = site_instance->GetSiteURL();
if (url.SchemeIs("brave"))
return false;
#if BUILDFLAG(ENABLE_EXTENSIONS)
bool result;
if (AtomBrowserClientExtensionsPart::ShouldAllowOpenURL(
Expand Down
2 changes: 2 additions & 0 deletions brave/browser/brave_content_browser_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ class BraveContentBrowserClient : public atom::AtomBrowserClient {
std::vector<std::string>* additional_allowed_schemes) override;
void GetAdditionalWebUISchemes(
std::vector<std::string>* additional_schemes) override;
bool CanCommitURL(
content::RenderProcessHost* process_host, const GURL& url) override;
bool ShouldAllowOpenURL(content::SiteInstance* site_instance,
const GURL& url) override;
bool IsURLAcceptableForWebUI(content::BrowserContext* browser_context,
Expand Down

2 comments on commit dddf8d5

@diracdeltas
Copy link
Member

Choose a reason for hiding this comment

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

++

@darkdh
Copy link
Member

@darkdh darkdh commented on dddf8d5 Aug 3, 2018

Choose a reason for hiding this comment

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

++

Please sign in to comment.