#include "components/security_interstitials/content/ssl_error_assistant.h"
#include <memory>
#include "build/build_config.h"
#include "components/grit/components_resources.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "net/cert/x509_certificate.h"
#include "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h"
#include "third_party/re2/src/re2/re2.h"
#include "ui/base/resource/resource_bundle.h"
namespace {
net::CertStatus MapToCertStatus(
chrome_browser_ssl::DynamicInterstitial::CertError error) { … }
std::unordered_set<std::string> HashesFromDynamicInterstitial(
const chrome_browser_ssl::DynamicInterstitial& entry) { … }
std::unique_ptr<std::unordered_set<std::string>> LoadCaptivePortalCertHashes(
const chrome_browser_ssl::SSLErrorAssistantConfig& proto) { … }
std::unique_ptr<std::vector<MITMSoftwareType>> LoadMITMSoftwareList(
const chrome_browser_ssl::SSLErrorAssistantConfig& proto) { … }
std::unique_ptr<std::vector<DynamicInterstitialInfo>>
LoadDynamicInterstitialList(
const chrome_browser_ssl::SSLErrorAssistantConfig& proto) { … }
bool RegexMatchesAny(const std::vector<std::string>& organization_names,
const std::string& pattern) { … }
bool MatchSSLInfoWithHashes(const net::SSLInfo& ssl_info,
std::unordered_set<std::string> spki_hashes) { … }
}
MITMSoftwareType::MITMSoftwareType(const std::string& name,
const std::string& issuer_common_name_regex,
const std::string& issuer_organization_regex)
: … { … }
DynamicInterstitialInfo::DynamicInterstitialInfo(
const std::unordered_set<std::string>& spki_hashes,
const std::string& issuer_common_name_regex,
const std::string& issuer_organization_regex,
const std::string& mitm_software_name,
chrome_browser_ssl::DynamicInterstitial::InterstitialPageType
interstitial_type,
int cert_error,
const GURL& support_url,
bool show_only_for_nonoverridable_errors)
: … { … }
DynamicInterstitialInfo::~DynamicInterstitialInfo() { … }
DynamicInterstitialInfo::DynamicInterstitialInfo(
const DynamicInterstitialInfo& other) = default;
SSLErrorAssistant::SSLErrorAssistant() { … }
SSLErrorAssistant::~SSLErrorAssistant() { … }
bool SSLErrorAssistant::IsKnownCaptivePortalCertificate(
const net::SSLInfo& ssl_info) { … }
std::optional<DynamicInterstitialInfo>
SSLErrorAssistant::MatchDynamicInterstitial(const net::SSLInfo& ssl_info,
bool is_overridable) { … }
const std::string SSLErrorAssistant::MatchKnownMITMSoftware(
const scoped_refptr<net::X509Certificate>& cert) { … }
std::unique_ptr<chrome_browser_ssl::SSLErrorAssistantConfig>
SSLErrorAssistant::GetErrorAssistantProtoFromResourceBundle() { … }
void SSLErrorAssistant::SetErrorAssistantProto(
std::unique_ptr<chrome_browser_ssl::SSLErrorAssistantConfig> proto) { … }
void SSLErrorAssistant::EnsureInitialized() { … }
void SSLErrorAssistant::ResetForTesting() { … }
int SSLErrorAssistant::GetErrorAssistantProtoVersionIdForTesting() const { … }