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
|
2020-07-22 05:34:34 +00:00
|
|
|
index 16d1ca932afddc1f2502e99384141b0814beb75c..8370d59e30fac2a416879aa9798be43f72fd5d90 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
|
2020-07-22 05:34:34 +00:00
|
|
|
@@ -7,28 +7,33 @@
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "base/bind.h"
|
|
|
|
+#include "base/command_line.h"
|
|
|
|
#include "base/feature_list.h"
|
|
|
|
#include "base/metrics/field_trial_params.h"
|
|
|
|
#include "base/metrics/histogram_macros.h"
|
2019-01-16 18:07:52 +00:00
|
|
|
#include "base/strings/pattern.h"
|
2018-09-14 18:03:43 +00:00
|
|
|
#include "base/strings/string_util.h"
|
2018-09-14 05:02:16 +00:00
|
|
|
#include "build/build_config.h"
|
|
|
|
+#if 0
|
|
|
|
#include "chrome/browser/browser_process.h"
|
|
|
|
#include "chrome/browser/profiles/profile.h"
|
2019-10-28 22:12:35 +00:00
|
|
|
#include "chrome/browser/reputation/reputation_web_contents_observer.h"
|
2018-09-14 05:02:16 +00:00
|
|
|
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
|
|
|
|
#include "chrome/browser/safe_browsing/ui_manager.h"
|
2019-12-11 00:22:35 +00:00
|
|
|
#include "chrome/browser/ssl/known_interception_disclosure_infobar_delegate.h"
|
2018-09-14 05:02:16 +00:00
|
|
|
+#endif
|
2019-10-18 19:57:34 +00:00
|
|
|
#include "chrome/browser/ssl/tls_deprecation_config.h"
|
|
|
|
#include "chrome/common/chrome_features.h"
|
|
|
|
#include "chrome/common/chrome_switches.h"
|
|
|
|
#include "chrome/common/pref_names.h"
|
2020-07-14 01:13:34 +00:00
|
|
|
#include "chrome/common/secure_origin_allowlist.h"
|
2019-05-28 20:18:10 +00:00
|
|
|
+#if 0
|
2019-05-13 18:49:01 +00:00
|
|
|
#include "components/omnibox/browser/omnibox_field_trial.h"
|
|
|
|
#include "components/omnibox/common/omnibox_features.h"
|
2019-07-03 01:22:09 +00:00
|
|
|
#include "components/password_manager/core/browser/password_manager_metrics_util.h"
|
2019-10-18 19:57:34 +00:00
|
|
|
-#include "components/prefs/pref_service.h"
|
2019-08-02 23:56:46 +00:00
|
|
|
#include "components/safe_browsing/buildflags.h"
|
2019-05-28 20:18:10 +00:00
|
|
|
+#endif
|
2019-10-18 19:57:34 +00:00
|
|
|
+#include "components/prefs/pref_service.h"
|
2019-05-28 20:18:10 +00:00
|
|
|
#include "components/security_state/content/content_utils.h"
|
|
|
|
#include "content/public/browser/browser_context.h"
|
2020-06-22 17:35:10 +00:00
|
|
|
#include "content/public/browser/navigation_entry.h"
|
2020-07-22 05:34:34 +00:00
|
|
|
@@ -51,7 +56,7 @@
|
2019-08-02 23:56:46 +00:00
|
|
|
#include "chrome/browser/chromeos/policy/policy_cert_service_factory.h"
|
2018-09-14 05:02:16 +00:00
|
|
|
#endif // defined(OS_CHROMEOS)
|
|
|
|
|
2019-08-02 23:56:46 +00:00
|
|
|
-#if BUILDFLAG(FULL_SAFE_BROWSING)
|
2018-09-14 05:02:16 +00:00
|
|
|
+#if 0
|
|
|
|
#include "chrome/browser/safe_browsing/chrome_password_protection_service.h"
|
|
|
|
#endif
|
|
|
|
|
2020-07-22 05:34:34 +00:00
|
|
|
@@ -95,9 +100,12 @@ bool IsLegacyTLS(GURL url, int connection_status) {
|
2019-10-18 19:57:34 +00:00
|
|
|
// default we treat TLS < 1.2 as Legacy, unless the "SSLVersionMin" policy is
|
|
|
|
// set.
|
|
|
|
std::string ssl_version_min_str = switches::kSSLVersionTLSv12;
|
|
|
|
- PrefService* local_state = g_browser_process->local_state();
|
|
|
|
- if (local_state && local_state->HasPrefPath(prefs::kSSLVersionMin)) {
|
|
|
|
- ssl_version_min_str = local_state->GetString(prefs::kSSLVersionMin);
|
|
|
|
+
|
|
|
|
+ // Read directly from the command line, since our pref store is not the same
|
|
|
|
+ // as Chrome's.
|
|
|
|
+ auto* cmd_line = base::CommandLine::ForCurrentProcess();
|
|
|
|
+ if (cmd_line->HasSwitch(::switches::kSSLVersionMin)) {
|
|
|
|
+ ssl_version_min_str = cmd_line->GetSwitchValueASCII(::switches::kSSLVersionMin);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Convert the pref string to an SSLVersion, if it is valid. Otherwise use the
|
2020-07-22 05:34:34 +00:00
|
|
|
@@ -117,8 +125,9 @@ bool IsLegacyTLS(GURL url, int connection_status) {
|
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
|
2019-07-03 01:22:09 +00:00
|
|
|
using password_manager::metrics_util::PasswordType;
|
|
|
|
-using safe_browsing::SafeBrowsingUIManager;
|
2018-09-14 05:02:16 +00:00
|
|
|
+#endif
|
|
|
|
|
|
|
|
SecurityStateTabHelper::SecurityStateTabHelper(
|
|
|
|
content::WebContents* web_contents)
|
2020-07-22 05:34:34 +00:00
|
|
|
@@ -164,6 +173,7 @@ SecurityStateTabHelper::GetVisibleSecurityState() {
|
2019-08-15 20:50:58 +00:00
|
|
|
// information is still being initialized, thus no need to check for that.
|
|
|
|
state->malicious_content_status = GetMaliciousContentStatus();
|
|
|
|
|
|
|
|
+#if 0
|
2019-10-28 22:12:35 +00:00
|
|
|
ReputationWebContentsObserver* reputation_web_contents_observer =
|
|
|
|
ReputationWebContentsObserver::FromWebContents(web_contents());
|
|
|
|
state->safety_tip_info =
|
2020-07-22 05:34:34 +00:00
|
|
|
@@ -172,7 +182,7 @@ SecurityStateTabHelper::GetVisibleSecurityState() {
|
2020-06-22 17:35:10 +00:00
|
|
|
->GetSafetyTipInfoForVisibleNavigation()
|
|
|
|
: security_state::SafetyTipInfo(
|
|
|
|
{security_state::SafetyTipStatus::kUnknown, GURL()});
|
|
|
|
-
|
2019-08-15 20:50:58 +00:00
|
|
|
+#endif
|
|
|
|
return state;
|
|
|
|
}
|
2020-06-22 17:35:10 +00:00
|
|
|
|
2020-07-22 05:34:34 +00:00
|
|
|
@@ -235,8 +245,10 @@ void SecurityStateTabHelper::DidFinishNavigation(
|
2019-12-11 00:22:35 +00:00
|
|
|
UMA_HISTOGRAM_BOOLEAN("interstitial.ssl.visited_site_after_warning", true);
|
|
|
|
}
|
|
|
|
|
|
|
|
+#if 0
|
|
|
|
MaybeShowKnownInterceptionDisclosureDialog(
|
|
|
|
web_contents(), visible_security_state->cert_status);
|
|
|
|
+#endif
|
|
|
|
}
|
2019-08-15 20:50:58 +00:00
|
|
|
|
2019-12-11 00:22:35 +00:00
|
|
|
void SecurityStateTabHelper::DidChangeVisibleSecurityState() {
|
2020-07-22 05:34:34 +00:00
|
|
|
@@ -260,6 +272,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)
|
2020-07-22 05:34:34 +00:00
|
|
|
@@ -342,6 +355,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const {
|
2018-09-14 05:02:16 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
return security_state::MALICIOUS_CONTENT_STATUS_NONE;
|
|
|
|
}
|
|
|
|
|