From 561fa7b45fbc02e88d7b49eb0cae02725bf7cc05 Mon Sep 17 00:00:00 2001 From: Carmelo Messina Date: Mon, 10 Jun 2024 17:50:39 +0200 Subject: [PATCH] merge Disable-FirstPartySets-and-StorageAccessAPI.patch and Disable-FLoC-and-privacy-sandbox.patch to simplify my work, they are all part of the privacy sandbox project --- build/cromite_patches_list.txt | 3 +- ...-FirstPartySets-and-StorageAccessAPI.patch | 98 ----------------- ...ox.patch => Disable-privacy-sandbox.patch} | 100 ++++++++++++++++-- 3 files changed, 90 insertions(+), 111 deletions(-) delete mode 100644 build/patches/Disable-FirstPartySets-and-StorageAccessAPI.patch rename build/patches/{Disable-FLoC-and-privacy-sandbox.patch => Disable-privacy-sandbox.patch} (69%) diff --git a/build/cromite_patches_list.txt b/build/cromite_patches_list.txt index d3722549..90643bdd 100644 --- a/build/cromite_patches_list.txt +++ b/build/cromite_patches_list.txt @@ -56,7 +56,7 @@ Keep-flag-to-allow-screenshots-in-Incognito-mode.patch Add-option-to-not-persist-tabs-across-sessions.patch Add-a-proxy-configuration-page.patch Add-custom-tab-intents-privacy-option.patch -Disable-FLoC-and-privacy-sandbox.patch +Disable-privacy-sandbox.patch History-number-of-days-privacy-setting.patch Disable-fetching-of-all-field-trials.patch Disable-plugins-enumeration.patch @@ -217,7 +217,6 @@ Clear-CORS-Preflight-Cache-on-clearing-data.patch Multi-Screen-Window-Placement-API-fix.patch Add-a-flag-to-disable-GamePad-API.patch Disable-WebGPU.patch -Disable-FirstPartySets-and-StorageAccessAPI.patch Disable-GetInstalledRelatedApps-API.patch Disable-GSA-by-default.patch Disable-PrivateStateTokens-API.patch diff --git a/build/patches/Disable-FirstPartySets-and-StorageAccessAPI.patch b/build/patches/Disable-FirstPartySets-and-StorageAccessAPI.patch deleted file mode 100644 index 11211cfd..00000000 --- a/build/patches/Disable-FirstPartySets-and-StorageAccessAPI.patch +++ /dev/null @@ -1,98 +0,0 @@ -From: uazo -Date: Tue, 2 May 2023 15:26:46 +0000 -Subject: Disable FirstPartySets and StorageAccessAPI - -License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html ---- - .../first_party_sets/first_party_sets_navigation_throttle.cc | 2 +- - .../first_party_sets/first_party_sets_policy_service.cc | 3 ++- - .../browser/privacy_sandbox/privacy_sandbox_service_impl.cc | 2 +- - components/privacy_sandbox/privacy_sandbox_prefs.cc | 2 +- - components/privacy_sandbox/tracking_protection_prefs.cc | 4 ++-- - .../Disable-FirstPartySets-and-StorageAccessAPI.inc | 1 + - 6 files changed, 8 insertions(+), 6 deletions(-) - create mode 100644 cromite_flags/third_party/blink/common/features_cc/Disable-FirstPartySets-and-StorageAccessAPI.inc - -diff --git a/chrome/browser/first_party_sets/first_party_sets_navigation_throttle.cc b/chrome/browser/first_party_sets/first_party_sets_navigation_throttle.cc ---- a/chrome/browser/first_party_sets/first_party_sets_navigation_throttle.cc -+++ b/chrome/browser/first_party_sets/first_party_sets_navigation_throttle.cc -@@ -77,7 +77,7 @@ FirstPartySetsNavigationThrottle::MaybeCreateNavigationThrottle( - // The `service` might be null for some irregular profiles. - // TODO(crbug.com/40233408): regular profiles and guest sessions - // aren't mutually exclusive on ChromeOS. -- if (!profile->IsRegularProfile() || profile->IsGuestSession()) -+ if (((true)) || !profile->IsRegularProfile() || profile->IsGuestSession()) - return nullptr; - - FirstPartySetsPolicyService* service = -diff --git a/chrome/browser/first_party_sets/first_party_sets_policy_service.cc b/chrome/browser/first_party_sets/first_party_sets_policy_service.cc ---- a/chrome/browser/first_party_sets/first_party_sets_policy_service.cc -+++ b/chrome/browser/first_party_sets/first_party_sets_policy_service.cc -@@ -59,6 +59,7 @@ const base::Value::Dict* GetOverridesPolicyForProfile( - } - - ServiceState GetServiceState(Profile* profile, bool pref_enabled) { -+ if ((true)) return ServiceState::kPermanentlyDisabled; - if (profile->IsSystemProfile() || profile->IsGuestSession() || - profile->IsOffTheRecord()) { - return ServiceState::kPermanentlyDisabled; -@@ -112,7 +113,7 @@ void FirstPartySetsPolicyService::Init() { - profile, profile->GetPrefs() && - profile->GetPrefs()->GetBoolean( - prefs::kPrivacySandboxRelatedWebsiteSetsEnabled)); -- -+ service_state_ = ServiceState::kPermanentlyDisabled; - if (service_state_ == ServiceState::kPermanentlyDisabled) { - OnReadyToNotifyDelegates(net::FirstPartySetsContextConfig(), - net::FirstPartySetsCacheFilter()); -diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_service_impl.cc b/chrome/browser/privacy_sandbox/privacy_sandbox_service_impl.cc ---- a/chrome/browser/privacy_sandbox/privacy_sandbox_service_impl.cc -+++ b/chrome/browser/privacy_sandbox/privacy_sandbox_service_impl.cc -@@ -424,7 +424,7 @@ bool PrivacySandboxServiceImpl::IsRestrictedNoticeEnabled() { - void PrivacySandboxServiceImpl::SetFirstPartySetsDataAccessEnabled( - bool enabled) { - pref_service_->SetBoolean(prefs::kPrivacySandboxRelatedWebsiteSetsEnabled, -- enabled); -+ false); - } - - bool PrivacySandboxServiceImpl::IsFirstPartySetsDataAccessEnabled() const { -diff --git a/components/privacy_sandbox/privacy_sandbox_prefs.cc b/components/privacy_sandbox/privacy_sandbox_prefs.cc ---- a/components/privacy_sandbox/privacy_sandbox_prefs.cc -+++ b/components/privacy_sandbox/privacy_sandbox_prefs.cc -@@ -48,7 +48,7 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) { - registry->RegisterBooleanPref( - prefs::kPrivacySandboxFirstPartySetsDataAccessAllowedInitialized, false); - registry->RegisterBooleanPref( -- prefs::kPrivacySandboxRelatedWebsiteSetsEnabled, true, -+ prefs::kPrivacySandboxRelatedWebsiteSetsEnabled, false, // must be disabled - user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); - - registry->RegisterBooleanPref(prefs::kPrivacySandboxTopicsConsentGiven, -diff --git a/components/privacy_sandbox/tracking_protection_prefs.cc b/components/privacy_sandbox/tracking_protection_prefs.cc ---- a/components/privacy_sandbox/tracking_protection_prefs.cc -+++ b/components/privacy_sandbox/tracking_protection_prefs.cc -@@ -64,14 +64,14 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) { - - // Tracking Protection Settings Prefs - registry->RegisterBooleanPref( -- prefs::kBlockAll3pcToggleEnabled, false, -+ prefs::kBlockAll3pcToggleEnabled, false, // with true enables FPS - user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); - registry->RegisterBooleanPref(prefs::kAllowAll3pcToggleEnabled, false); - registry->RegisterIntegerPref( - prefs::kTrackingProtectionLevel, - static_cast(TrackingProtectionLevel::kStandard), - user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); -- registry->RegisterBooleanPref(prefs::kTrackingProtection3pcdEnabled, false); -+ registry->RegisterBooleanPref(prefs::kTrackingProtection3pcdEnabled, false); // with true enables FPS - registry->RegisterBooleanPref( - prefs::kIpProtectionEnabled, false, - user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); -diff --git a/cromite_flags/third_party/blink/common/features_cc/Disable-FirstPartySets-and-StorageAccessAPI.inc b/cromite_flags/third_party/blink/common/features_cc/Disable-FirstPartySets-and-StorageAccessAPI.inc -new file mode 100644 ---- /dev/null -+++ b/cromite_flags/third_party/blink/common/features_cc/Disable-FirstPartySets-and-StorageAccessAPI.inc -@@ -0,0 +1 @@ -+SET_CROMITE_FEATURE_DISABLED(kSharedStorageAPI); --- diff --git a/build/patches/Disable-FLoC-and-privacy-sandbox.patch b/build/patches/Disable-privacy-sandbox.patch similarity index 69% rename from build/patches/Disable-FLoC-and-privacy-sandbox.patch rename to build/patches/Disable-privacy-sandbox.patch index bb3c8bd6..afed76fe 100644 --- a/build/patches/Disable-FLoC-and-privacy-sandbox.patch +++ b/build/patches/Disable-privacy-sandbox.patch @@ -1,30 +1,35 @@ From: uazo Date: Sat, 13 Nov 2021 09:17:06 +0000 -Subject: Disable FLoC and privacy sandbox +Subject: Disable privacy sandbox Remove UI from the settings and set the flags to inactive Permanently removes FLoC support, disabling the download of LSH clusters, the marking the history navigation and the javascript API and permission policies. +Also disable FirstPartySets and StorageAccessAPI. Original License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- .../browser/chrome_content_browser_client.cc | 3 +++ + .../first_party_sets_navigation_throttle.cc | 2 +- + .../first_party_sets_policy_service.cc | 3 ++- chrome/browser/prefs/browser_prefs.cc | 2 +- + .../privacy_sandbox_service_impl.cc | 2 +- .../privacy_sandbox_settings_delegate.cc | 1 + .../privacy_sandbox/privacy_sandbox_prompt.cc | 1 + .../history/core/browser/history_backend.cc | 13 +------------ .../privacy_sandbox_attestations.cc | 2 -- .../privacy_sandbox_features.cc | 4 ++++ - .../privacy_sandbox/privacy_sandbox_prefs.cc | 2 +- + .../privacy_sandbox/privacy_sandbox_prefs.cc | 4 ++-- .../privacy_sandbox_settings_impl.cc | 19 ++++++++++++++----- + .../tracking_protection_prefs.cc | 4 ++-- .../identity_manager/account_capabilities.cc | 2 +- - .../Disable-FLoC-and-privacy-sandbox.inc | 1 + - .../Disable-FLoC-and-privacy-sandbox.inc | 4 ++++ + .../features_cc/Disable-privacy-sandbox.inc | 1 + + .../features_cc/Disable-privacy-sandbox.inc | 4 ++++ third_party/blink/common/features.cc | 1 + - 13 files changed, 33 insertions(+), 22 deletions(-) - create mode 100644 cromite_flags/content/common/features_cc/Disable-FLoC-and-privacy-sandbox.inc - create mode 100644 cromite_flags/third_party/blink/common/features_cc/Disable-FLoC-and-privacy-sandbox.inc + 17 files changed, 40 insertions(+), 28 deletions(-) + create mode 100644 cromite_flags/content/common/features_cc/Disable-privacy-sandbox.inc + create mode 100644 cromite_flags/third_party/blink/common/features_cc/Disable-privacy-sandbox.inc diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc --- a/chrome/browser/chrome_content_browser_client.cc @@ -39,6 +44,38 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/ch Profile* profile = Profile::FromBrowserContext(browser_context); auto* privacy_sandbox_settings = +diff --git a/chrome/browser/first_party_sets/first_party_sets_navigation_throttle.cc b/chrome/browser/first_party_sets/first_party_sets_navigation_throttle.cc +--- a/chrome/browser/first_party_sets/first_party_sets_navigation_throttle.cc ++++ b/chrome/browser/first_party_sets/first_party_sets_navigation_throttle.cc +@@ -77,7 +77,7 @@ FirstPartySetsNavigationThrottle::MaybeCreateNavigationThrottle( + // The `service` might be null for some irregular profiles. + // TODO(crbug.com/40233408): regular profiles and guest sessions + // aren't mutually exclusive on ChromeOS. +- if (!profile->IsRegularProfile() || profile->IsGuestSession()) ++ if (((true)) || !profile->IsRegularProfile() || profile->IsGuestSession()) + return nullptr; + + FirstPartySetsPolicyService* service = +diff --git a/chrome/browser/first_party_sets/first_party_sets_policy_service.cc b/chrome/browser/first_party_sets/first_party_sets_policy_service.cc +--- a/chrome/browser/first_party_sets/first_party_sets_policy_service.cc ++++ b/chrome/browser/first_party_sets/first_party_sets_policy_service.cc +@@ -59,6 +59,7 @@ const base::Value::Dict* GetOverridesPolicyForProfile( + } + + ServiceState GetServiceState(Profile* profile, bool pref_enabled) { ++ if ((true)) return ServiceState::kPermanentlyDisabled; + if (profile->IsSystemProfile() || profile->IsGuestSession() || + profile->IsOffTheRecord()) { + return ServiceState::kPermanentlyDisabled; +@@ -112,7 +113,7 @@ void FirstPartySetsPolicyService::Init() { + profile, profile->GetPrefs() && + profile->GetPrefs()->GetBoolean( + prefs::kPrivacySandboxRelatedWebsiteSetsEnabled)); +- ++ service_state_ = ServiceState::kPermanentlyDisabled; + if (service_state_ == ServiceState::kPermanentlyDisabled) { + OnReadyToNotifyDelegates(net::FirstPartySetsContextConfig(), + net::FirstPartySetsCacheFilter()); 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 @@ -51,6 +88,18 @@ diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browse // Deprecated 03/2024. registry->RegisterBooleanPref(kShowInternalAccessibilityTree, false); +diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_service_impl.cc b/chrome/browser/privacy_sandbox/privacy_sandbox_service_impl.cc +--- a/chrome/browser/privacy_sandbox/privacy_sandbox_service_impl.cc ++++ b/chrome/browser/privacy_sandbox/privacy_sandbox_service_impl.cc +@@ -424,7 +424,7 @@ bool PrivacySandboxServiceImpl::IsRestrictedNoticeEnabled() { + void PrivacySandboxServiceImpl::SetFirstPartySetsDataAccessEnabled( + bool enabled) { + pref_service_->SetBoolean(prefs::kPrivacySandboxRelatedWebsiteSetsEnabled, +- enabled); ++ false); + } + + bool PrivacySandboxServiceImpl::IsFirstPartySetsDataAccessEnabled() const { diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate.cc b/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate.cc --- a/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate.cc +++ b/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate.cc @@ -131,6 +180,15 @@ diff --git a/components/privacy_sandbox/privacy_sandbox_prefs.cc b/components/pr registry->RegisterTimePref(prefs::kPrivacySandboxTopicsDataAccessibleSince, base::Time()); +@@ -48,7 +48,7 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) { + registry->RegisterBooleanPref( + prefs::kPrivacySandboxFirstPartySetsDataAccessAllowedInitialized, false); + registry->RegisterBooleanPref( +- prefs::kPrivacySandboxRelatedWebsiteSetsEnabled, true, ++ prefs::kPrivacySandboxRelatedWebsiteSetsEnabled, false, // must be disabled + user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); + + registry->RegisterBooleanPref(prefs::kPrivacySandboxTopicsConsentGiven, diff --git a/components/privacy_sandbox/privacy_sandbox_settings_impl.cc b/components/privacy_sandbox/privacy_sandbox_settings_impl.cc --- a/components/privacy_sandbox/privacy_sandbox_settings_impl.cc +++ b/components/privacy_sandbox/privacy_sandbox_settings_impl.cc @@ -209,6 +267,26 @@ diff --git a/components/privacy_sandbox/privacy_sandbox_settings_impl.cc b/compo if (delegate_->IsIncognitoProfile()) { return Status::kIncognitoProfile; } +diff --git a/components/privacy_sandbox/tracking_protection_prefs.cc b/components/privacy_sandbox/tracking_protection_prefs.cc +--- a/components/privacy_sandbox/tracking_protection_prefs.cc ++++ b/components/privacy_sandbox/tracking_protection_prefs.cc +@@ -64,14 +64,14 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) { + + // Tracking Protection Settings Prefs + registry->RegisterBooleanPref( +- prefs::kBlockAll3pcToggleEnabled, false, ++ prefs::kBlockAll3pcToggleEnabled, false, // with true enables FPS + user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); + registry->RegisterBooleanPref(prefs::kAllowAll3pcToggleEnabled, false); + registry->RegisterIntegerPref( + prefs::kTrackingProtectionLevel, + static_cast(TrackingProtectionLevel::kStandard), + user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); +- registry->RegisterBooleanPref(prefs::kTrackingProtection3pcdEnabled, false); ++ registry->RegisterBooleanPref(prefs::kTrackingProtection3pcdEnabled, false); // with true enables FPS + registry->RegisterBooleanPref( + prefs::kIpProtectionEnabled, false, + user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); diff --git a/components/signin/public/identity_manager/account_capabilities.cc b/components/signin/public/identity_manager/account_capabilities.cc --- a/components/signin/public/identity_manager/account_capabilities.cc +++ b/components/signin/public/identity_manager/account_capabilities.cc @@ -221,16 +299,16 @@ diff --git a/components/signin/public/identity_manager/account_capabilities.cc b } signin::Tribool AccountCapabilities::is_opted_in_to_parental_supervision() -diff --git a/cromite_flags/content/common/features_cc/Disable-FLoC-and-privacy-sandbox.inc b/cromite_flags/content/common/features_cc/Disable-FLoC-and-privacy-sandbox.inc +diff --git a/cromite_flags/content/common/features_cc/Disable-privacy-sandbox.inc b/cromite_flags/content/common/features_cc/Disable-privacy-sandbox.inc new file mode 100644 --- /dev/null -+++ b/cromite_flags/content/common/features_cc/Disable-FLoC-and-privacy-sandbox.inc ++++ b/cromite_flags/content/common/features_cc/Disable-privacy-sandbox.inc @@ -0,0 +1 @@ +SET_CROMITE_FEATURE_DISABLED(kPrivacySandboxAdsAPIsM1Override); -diff --git a/cromite_flags/third_party/blink/common/features_cc/Disable-FLoC-and-privacy-sandbox.inc b/cromite_flags/third_party/blink/common/features_cc/Disable-FLoC-and-privacy-sandbox.inc +diff --git a/cromite_flags/third_party/blink/common/features_cc/Disable-privacy-sandbox.inc b/cromite_flags/third_party/blink/common/features_cc/Disable-privacy-sandbox.inc new file mode 100644 --- /dev/null -+++ b/cromite_flags/third_party/blink/common/features_cc/Disable-FLoC-and-privacy-sandbox.inc ++++ b/cromite_flags/third_party/blink/common/features_cc/Disable-privacy-sandbox.inc @@ -0,0 +1,4 @@ +SET_CROMITE_FEATURE_DISABLED(kFencedFrames); +SET_CROMITE_FEATURE_DISABLED(kSharedStorageAPI);