disable support for ClientHints and renable FeaturePolicyForClientHints

This commit is contained in:
Carmelo Messina 2022-01-27 09:43:10 +01:00
parent 6c2adcaf80
commit 61e2c1ac74
No known key found for this signature in database
GPG key ID: 968894BE688289FD

View file

@ -5,10 +5,28 @@ Subject: Override UA client hint for model
Hard-code model to SAMSUNG SM-G960U
Disable permissions policy by default
---
content/common/user_agent.cc | 7 +------
content/public/common/content_features.cc | 2 +-
2 files changed, 2 insertions(+), 7 deletions(-)
chrome/browser/prefs/browser_prefs.cc | 2 +-
content/common/user_agent.cc | 7 +------
content/public/common/content_features.cc | 2 +-
services/network/public/cpp/client_hints.cc | 1 +
services/network/public/cpp/features.cc | 2 +-
third_party/blink/common/client_hints/client_hints.cc | 1 +
.../blink/common/client_hints/enabled_client_hints.cc | 5 ++++-
third_party/blink/common/features.cc | 4 ++--
8 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -730,7 +730,7 @@ void RegisterLocalStatePrefsForMigration(PrefRegistrySimple* registry) {
registry->RegisterIntegerPref(kStabilityDebuggerPresent, 0);
registry->RegisterIntegerPref(kStabilityDebuggerNotPresent, 0);
- registry->RegisterBooleanPref(kUserAgentClientHintsEnabled, true);
+ registry->RegisterBooleanPref(kUserAgentClientHintsEnabled, false);
registry->RegisterBooleanPref(kCloudPolicyOverridesPlatformPolicy, false);
diff --git a/content/common/user_agent.cc b/content/common/user_agent.cc
--- a/content/common/user_agent.cc
+++ b/content/common/user_agent.cc
@ -29,15 +47,106 @@ diff --git a/content/common/user_agent.cc b/content/common/user_agent.cc
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc
--- a/content/public/common/content_features.cc
+++ b/content/public/common/content_features.cc
@@ -322,7 +322,7 @@ const base::Feature kExtraSafelistedRequestHeadersForOutOfBlinkCors{
@@ -237,7 +237,7 @@ const base::Feature kCrashReporting{"CrashReporting",
// Enables support for the `Critical-CH` response header.
// https://github.com/WICG/client-hints-infrastructure/blob/master/reliability.md#critical-ch
const base::Feature kCriticalClientHint{"CriticalClientHint",
- base::FEATURE_ENABLED_BY_DEFAULT};
+ base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether Client Hints are guarded by Permissions Policy.
const base::Feature kFeaturePolicyForClientHints{
- "FeaturePolicyForClientHints", base::FEATURE_ENABLED_BY_DEFAULT};
+ "FeaturePolicyForClientHints", base::FEATURE_DISABLED_BY_DEFAULT};
// Enable cross-origin sharing of WebAssembly modules.
const base::Feature kCrossOriginWebAssemblyModuleSharingEnabled{
diff --git a/services/network/public/cpp/client_hints.cc b/services/network/public/cpp/client_hints.cc
--- a/services/network/public/cpp/client_hints.cc
+++ b/services/network/public/cpp/client_hints.cc
@@ -89,6 +89,7 @@ const DecodeMap& GetDecodeMap() {
// Enables fixes for matching src: local() for web fonts correctly against full
// font name or postscript name. Rolling out behind a flag, as enabling this
absl::optional<std::vector<network::mojom::WebClientHintsType>>
ParseClientHintsHeader(const std::string& header) {
+ if ((true)) return absl::nullopt;
// Accept-CH is an sh-list of tokens; see:
// https://httpwg.org/http-extensions/client-hints.html#rfc.section.3.1
absl::optional<net::structured_headers::List> maybe_list =
diff --git a/services/network/public/cpp/features.cc b/services/network/public/cpp/features.cc
--- a/services/network/public/cpp/features.cc
+++ b/services/network/public/cpp/features.cc
@@ -195,7 +195,7 @@ const base::Feature kWebSocketReassembleShortMessages{
// See:
// https://tools.ietf.org/html/draft-davidben-http-client-hint-reliability-02#section-4.3
const base::Feature kAcceptCHFrame{"AcceptCHFrame",
- base::FEATURE_ENABLED_BY_DEFAULT};
+ base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kSCTAuditingRetryAndPersistReports{
"SCTAuditingRetryAndPersistReports", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/third_party/blink/common/client_hints/client_hints.cc b/third_party/blink/common/client_hints/client_hints.cc
--- a/third_party/blink/common/client_hints/client_hints.cc
+++ b/third_party/blink/common/client_hints/client_hints.cc
@@ -91,6 +91,7 @@ const size_t kWebEffectiveConnectionTypeMappingCount =
base::size(kWebEffectiveConnectionTypeMapping);
bool IsClientHintSentByDefault(network::mojom::WebClientHintsType type) {
+ if ((true)) return false;
switch (type) {
case network::mojom::WebClientHintsType::kUA:
case network::mojom::WebClientHintsType::kUAMobile:
diff --git a/third_party/blink/common/client_hints/enabled_client_hints.cc b/third_party/blink/common/client_hints/enabled_client_hints.cc
--- a/third_party/blink/common/client_hints/enabled_client_hints.cc
+++ b/third_party/blink/common/client_hints/enabled_client_hints.cc
@@ -21,6 +21,7 @@ namespace {
using ::network::mojom::WebClientHintsType;
bool IsDisabledByFeature(const WebClientHintsType type) {
+ if ((true)) return true;
switch (type) {
case WebClientHintsType::kUA:
case WebClientHintsType::kUAArch:
@@ -88,6 +89,7 @@ bool IsUaReducedClientHintEnabled(
const GURL& url,
const GURL* third_party_url,
const net::HttpResponseHeaders* response_headers) {
+ if ((true)) return false;
blink::TrialTokenValidator validator;
base::Time now = base::Time::Now();
if (third_party_url == nullptr) {
@@ -123,7 +125,7 @@ bool IsUaReducedClientHintEnabled(
} // namespace
bool EnabledClientHints::IsEnabled(const WebClientHintsType type) const {
- return enabled_types_[static_cast<int>(type)];
+ return false;
}
void EnabledClientHints::SetIsEnabled(const WebClientHintsType type,
@@ -148,6 +150,7 @@ void EnabledClientHints::SetIsEnabled(
std::vector<WebClientHintsType> EnabledClientHints::GetEnabledHints() const {
std::vector<WebClientHintsType> hints;
+ if ((true)) return hints;
for (const auto& elem : network::GetClientHintToNameMap()) {
const auto& type = elem.first;
if (IsEnabled(type))
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc
--- a/third_party/blink/common/features.cc
+++ b/third_party/blink/common/features.cc
@@ -141,7 +141,7 @@ const base::Feature kMixedContentAutoupgrade{"AutoupgradeMixedContent",
// An experimental replacement for the `User-Agent` header, defined in
// https://tools.ietf.org/html/draft-west-ua-client-hints.
const base::Feature kUserAgentClientHint{"UserAgentClientHint",
- base::FEATURE_ENABLED_BY_DEFAULT};
+ base::FEATURE_DISABLED_BY_DEFAULT};
// Handle prefers-color-scheme user preference media feature via client hints.
const base::Feature kPrefersColorSchemeClientHintHeader{
@@ -729,7 +729,7 @@ const base::Feature kResamplingScrollEvents{"ResamplingScrollEvents",
const base::Feature kAllowClientHintsToThirdParty {
"AllowClientHintsToThirdParty",
#if defined(OS_ANDROID)
- base::FEATURE_ENABLED_BY_DEFAULT
+ base::FEATURE_DISABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif
--
2.20.1