2018-10-24 18:24:11 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-09-21 00:30:26 +00:00
|
|
|
From: deepak1556 <hop2deep@gmail.com>
|
|
|
|
Date: Thu, 20 Sep 2018 17:50:34 -0700
|
|
|
|
Subject: ssl_security_state_tab_helper.patch
|
|
|
|
|
|
|
|
Allows populating security tab info for devtools in Electron.
|
|
|
|
|
2018-09-14 05:02:16 +00:00
|
|
|
diff --git a/chrome/browser/ssl/security_state_tab_helper.cc b/chrome/browser/ssl/security_state_tab_helper.cc
|
2019-01-12 01:00:43 +00:00
|
|
|
index aebdb130ba687e0d0c0aa45a08b1820b67d3c25c..fdbeb9cd398eac5659b1dac4af9094c5a5d531f4 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/chrome/browser/ssl/security_state_tab_helper.cc
|
|
|
|
+++ b/chrome/browser/ssl/security_state_tab_helper.cc
|
2018-09-14 18:03:43 +00:00
|
|
|
@@ -13,17 +13,23 @@
|
|
|
|
#include "base/strings/string_util.h"
|
2018-09-14 05:02:16 +00:00
|
|
|
#include "base/time/time.h"
|
|
|
|
#include "build/build_config.h"
|
|
|
|
+#if 0
|
|
|
|
#include "chrome/browser/browser_process.h"
|
|
|
|
#include "chrome/browser/profiles/profile.h"
|
|
|
|
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
|
|
|
|
#include "chrome/browser/safe_browsing/ui_manager.h"
|
|
|
|
+#endif
|
2018-09-14 18:03:43 +00:00
|
|
|
#include "chrome/common/chrome_switches.h"
|
|
|
|
#include "chrome/common/pref_names.h"
|
|
|
|
#include "chrome/common/secure_origin_whitelist.h"
|
2018-09-14 05:02:16 +00:00
|
|
|
#include "components/prefs/pref_service.h"
|
|
|
|
+#if 0
|
|
|
|
#include "components/safe_browsing/features.h"
|
|
|
|
+#endif
|
|
|
|
#include "components/security_state/content/content_utils.h"
|
|
|
|
+#if 0
|
|
|
|
#include "components/toolbar/toolbar_field_trial.h"
|
|
|
|
+#endif
|
|
|
|
#include "content/public/browser/browser_context.h"
|
|
|
|
#include "content/public/browser/navigation_entry.h"
|
|
|
|
#include "content/public/browser/navigation_handle.h"
|
2018-09-14 18:03:43 +00:00
|
|
|
@@ -43,7 +49,7 @@
|
2018-09-14 05:02:16 +00:00
|
|
|
#include "chrome/browser/chromeos/policy/policy_cert_service_factory.h"
|
|
|
|
#endif // defined(OS_CHROMEOS)
|
|
|
|
|
|
|
|
-#if defined(SAFE_BROWSING_DB_LOCAL)
|
|
|
|
+#if 0
|
|
|
|
#include "chrome/browser/safe_browsing/chrome_password_protection_service.h"
|
|
|
|
#endif
|
|
|
|
|
2018-10-24 23:25:48 +00:00
|
|
|
@@ -79,7 +85,9 @@ bool IsOriginSecureWithWhitelist(
|
2018-09-14 05:02:16 +00:00
|
|
|
|
2018-10-24 23:25:48 +00:00
|
|
|
} // namespace
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
+#if 0
|
|
|
|
using safe_browsing::SafeBrowsingUIManager;
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
SecurityStateTabHelper::SecurityStateTabHelper(
|
|
|
|
content::WebContents* web_contents)
|
2018-10-24 23:25:48 +00:00
|
|
|
@@ -87,8 +95,11 @@ SecurityStateTabHelper::SecurityStateTabHelper(
|
2018-09-14 05:02:16 +00:00
|
|
|
logged_http_warning_on_current_navigation_(false),
|
|
|
|
is_incognito_(false) {
|
|
|
|
content::BrowserContext* context = web_contents->GetBrowserContext();
|
|
|
|
- if (context->IsOffTheRecord() &&
|
|
|
|
- !Profile::FromBrowserContext(context)->IsGuestSession()) {
|
|
|
|
+ if (context->IsOffTheRecord()
|
|
|
|
+#if 0
|
|
|
|
+ && !Profile::FromBrowserContext(context)->IsGuestSession()
|
|
|
|
+#endif
|
|
|
|
+ ) {
|
|
|
|
is_incognito_ = true;
|
|
|
|
}
|
|
|
|
}
|
2018-10-24 23:25:48 +00:00
|
|
|
@@ -173,6 +184,7 @@ void SecurityStateTabHelper::DidFinishNavigation(
|
2018-09-14 05:02:16 +00:00
|
|
|
UMA_HISTOGRAM_BOOLEAN("interstitial.ssl.visited_site_after_warning", true);
|
|
|
|
}
|
|
|
|
|
|
|
|
+#if 0
|
|
|
|
// Security indicator UI study (https://crbug.com/803501): Show a message in
|
|
|
|
// the console to reduce developer confusion about the experimental UI
|
|
|
|
// treatments for HTTPS pages with EV certificates.
|
2018-10-24 23:25:48 +00:00
|
|
|
@@ -200,6 +212,7 @@ void SecurityStateTabHelper::DidFinishNavigation(
|
2018-09-14 05:02:16 +00:00
|
|
|
"Validation is still valid.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecurityStateTabHelper::DidChangeVisibleSecurityState() {
|
2018-10-24 23:25:48 +00:00
|
|
|
@@ -273,6 +286,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const {
|
2018-09-14 05:02:16 +00:00
|
|
|
web_contents()->GetController().GetVisibleEntry();
|
|
|
|
if (!entry)
|
|
|
|
return security_state::MALICIOUS_CONTENT_STATUS_NONE;
|
|
|
|
+#if 0
|
|
|
|
safe_browsing::SafeBrowsingService* sb_service =
|
|
|
|
g_browser_process->safe_browsing_service();
|
|
|
|
if (!sb_service)
|
2018-10-24 23:25:48 +00:00
|
|
|
@@ -341,6 +355,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const {
|
2018-09-14 05:02:16 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
return security_state::MALICIOUS_CONTENT_STATUS_NONE;
|
|
|
|
}
|
|
|
|
|
2018-10-24 23:25:48 +00:00
|
|
|
@@ -361,15 +376,19 @@ std::vector<std::string> SecurityStateTabHelper::GetSecureOriginsAndPatterns()
|
2018-09-14 18:03:43 +00:00
|
|
|
const {
|
|
|
|
const base::CommandLine& command_line =
|
|
|
|
*base::CommandLine::ForCurrentProcess();
|
|
|
|
+#if 0
|
|
|
|
Profile* profile =
|
|
|
|
Profile::FromBrowserContext(web_contents()->GetBrowserContext());
|
|
|
|
PrefService* prefs = profile->GetPrefs();
|
|
|
|
+#endif
|
|
|
|
std::string origins_str = "";
|
|
|
|
if (command_line.HasSwitch(switches::kUnsafelyTreatInsecureOriginAsSecure)) {
|
|
|
|
origins_str = command_line.GetSwitchValueASCII(
|
|
|
|
switches::kUnsafelyTreatInsecureOriginAsSecure);
|
|
|
|
+#if 0
|
|
|
|
} else if (prefs->HasPrefPath(prefs::kUnsafelyTreatInsecureOriginAsSecure)) {
|
|
|
|
origins_str = prefs->GetString(prefs::kUnsafelyTreatInsecureOriginAsSecure);
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
return secure_origin_whitelist::ParseWhitelist(origins_str);
|
|
|
|
}
|
|
|
|
diff --git a/chrome/common/secure_origin_whitelist.cc b/chrome/common/secure_origin_whitelist.cc
|
2019-01-12 01:00:43 +00:00
|
|
|
index b70d6ced887d2a2ecb576b20d79e7fc4272e2054..5a75fe115c3c77f4a9edf7913b47341a757d1b42 100644
|
2018-09-14 18:03:43 +00:00
|
|
|
--- a/chrome/common/secure_origin_whitelist.cc
|
|
|
|
+++ b/chrome/common/secure_origin_whitelist.cc
|
|
|
|
@@ -13,7 +13,9 @@
|
|
|
|
#include "chrome/common/chrome_switches.h"
|
|
|
|
#include "chrome/common/pref_names.h"
|
|
|
|
#include "components/prefs/pref_registry_simple.h"
|
|
|
|
+#if 0
|
|
|
|
#include "extensions/common/constants.h"
|
|
|
|
+#endif
|
|
|
|
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
|
|
|
|
#include "url/gurl.h"
|
|
|
|
#include "url/origin.h"
|
2018-09-21 00:30:26 +00:00
|
|
|
@@ -163,7 +165,9 @@ std::vector<std::string> GetWhitelist() {
|
2018-09-14 18:03:43 +00:00
|
|
|
|
|
|
|
std::set<std::string> GetSchemesBypassingSecureContextCheck() {
|
|
|
|
std::set<std::string> schemes;
|
|
|
|
+#if 0
|
|
|
|
schemes.insert(extensions::kExtensionScheme);
|
|
|
|
+#endif
|
|
|
|
return schemes;
|
|
|
|
}
|
|
|
|
|