diff --git a/build/bromite_patches_list.txt b/build/bromite_patches_list.txt index 24a70da1..2aef5ca4 100644 --- a/build/bromite_patches_list.txt +++ b/build/bromite_patches_list.txt @@ -271,4 +271,7 @@ AudioBuffer-AnalyserNode-fp-mitigations.patch 00Remove-ChromiumNetworkAdapter.patch 00Internal-firewall.patch 00Disable-devtools-remote-and-custom-protocols.patch -00Remove-detection-of-captive-portals.patch \ No newline at end of file +00Remove-detection-of-captive-portals.patch +00Disable-SHA1-Server-Signature.patch +00Remove-auth-header-upon-cross-origin-redirect.patch +00Clear-CORS-Preflight-Cache-on-clearing-data.patch \ No newline at end of file diff --git a/build/patches/00Clear-CORS-Preflight-Cache-on-clearing-data.patch b/build/patches/00Clear-CORS-Preflight-Cache-on-clearing-data.patch new file mode 100644 index 00000000..484b1d2e --- /dev/null +++ b/build/patches/00Clear-CORS-Preflight-Cache-on-clearing-data.patch @@ -0,0 +1,91 @@ +From: uazo +Date: Wed, 19 Apr 2023 09:59:18 +0000 +Subject: Clear CORS Preflight Cache on clearing data + +--- + services/network/cors/preflight_cache.cc | 4 ++++ + services/network/cors/preflight_cache.h | 2 ++ + services/network/cors/preflight_controller.cc | 4 ++++ + services/network/cors/preflight_controller.h | 2 ++ + services/network/cors/preflight_result.cc | 2 +- + services/network/network_context.cc | 2 ++ + 6 files changed, 15 insertions(+), 1 deletion(-) + +diff --git a/services/network/cors/preflight_cache.cc b/services/network/cors/preflight_cache.cc +--- a/services/network/cors/preflight_cache.cc ++++ b/services/network/cors/preflight_cache.cc +@@ -151,6 +151,10 @@ void PreflightCache::MayPurgeForTesting(size_t max_entries, size_t purge_unit) { + MayPurge(max_entries, purge_unit); + } + ++void PreflightCache::ClearAll() { ++ cache_.clear(); ++} ++ + void PreflightCache::MayPurge(size_t max_entries, size_t purge_unit) { + if (cache_.size() <= max_entries) + return; +diff --git a/services/network/cors/preflight_cache.h b/services/network/cors/preflight_cache.h +--- a/services/network/cors/preflight_cache.h ++++ b/services/network/cors/preflight_cache.h +@@ -69,6 +69,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) PreflightCache final { + // for testing. + void MayPurgeForTesting(size_t max_entries, size_t purge_unit); + ++ void ClearAll(); ++ + private: + void MayPurge(size_t max_entries, size_t purge_unit); + +diff --git a/services/network/cors/preflight_controller.cc b/services/network/cors/preflight_controller.cc +--- a/services/network/cors/preflight_controller.cc ++++ b/services/network/cors/preflight_controller.cc +@@ -686,6 +686,10 @@ void PreflightController::PerformPreflightCheck( + (*emplaced_pair.first)->Request(loader_factory); + } + ++void PreflightController::ClearCache() { ++ cache_.ClearAll(); ++} ++ + void PreflightController::RemoveLoader(PreflightLoader* loader) { + auto it = loaders_.find(loader); + DCHECK(it != loaders_.end()); +diff --git a/services/network/cors/preflight_controller.h b/services/network/cors/preflight_controller.h +--- a/services/network/cors/preflight_controller.h ++++ b/services/network/cors/preflight_controller.h +@@ -119,6 +119,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) PreflightController final { + const net::NetLogWithSource& net_log, + bool acam_preflight_spec_conformant); + ++ void ClearCache(); ++ + private: + class PreflightLoader; + +diff --git a/services/network/cors/preflight_result.cc b/services/network/cors/preflight_result.cc +--- a/services/network/cors/preflight_result.cc ++++ b/services/network/cors/preflight_result.cc +@@ -37,7 +37,7 @@ constexpr base::TimeDelta kDefaultTimeout = base::Seconds(5); + // Maximum cache expiry time. Even if a CORS-preflight response contains + // Access-Control-Max-Age header that specifies a longer expiry time, this + // maximum time is applied. +-constexpr base::TimeDelta kMaxTimeout = base::Hours(2); ++constexpr base::TimeDelta kMaxTimeout = base::Seconds(600); + + // Holds TickClock instance to overwrite TimeTicks::Now() for testing. + const base::TickClock* tick_clock_for_testing = nullptr; +diff --git a/services/network/network_context.cc b/services/network/network_context.cc +--- a/services/network/network_context.cc ++++ b/services/network/network_context.cc +@@ -974,6 +974,8 @@ void NetworkContext::ClearHttpCache(base::Time start_time, + base::BindOnce(&NetworkContext::OnHttpCacheCleared, + base::Unretained(this), std::move(callback)))); + ++ cors_preflight_controller_.ClearCache(); ++ + NetworkServiceMemoryCache* memory_cache = GetMemoryCache(); + if (memory_cache) + memory_cache->Clear(); +-- +2.25.1 diff --git a/build/patches/00Disable-SHA1-Server-Signature.patch b/build/patches/00Disable-SHA1-Server-Signature.patch new file mode 100644 index 00000000..3d646664 --- /dev/null +++ b/build/patches/00Disable-SHA1-Server-Signature.patch @@ -0,0 +1,24 @@ +From: uazo +Date: Tue, 18 Apr 2023 14:17:19 +0000 +Subject: Disable SHA1 Server Signature + +--- + net/base/features.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/net/base/features.cc b/net/base/features.cc +--- a/net/base/features.cc ++++ b/net/base/features.cc +@@ -78,8 +78,8 @@ BASE_FEATURE(kUseDnsHttpsSvcbAlpn, + base::FEATURE_DISABLED_BY_DEFAULT); + + BASE_FEATURE(kSHA1ServerSignature, +- "SHA1ServerSignature", +- base::FEATURE_ENABLED_BY_DEFAULT); ++ "SHA1ServerSignature", // disabled ++ base::FEATURE_DISABLED_BY_DEFAULT); // in bromite + + BASE_FEATURE(kEnableTLS13EarlyData, + "EnableTLS13EarlyData", +-- +2.25.1 diff --git a/build/patches/00Remove-auth-header-upon-cross-origin-redirect.patch b/build/patches/00Remove-auth-header-upon-cross-origin-redirect.patch new file mode 100644 index 00000000..abbad82a --- /dev/null +++ b/build/patches/00Remove-auth-header-upon-cross-origin-redirect.patch @@ -0,0 +1,37 @@ +From: uazo +Date: Wed, 19 Apr 2023 06:53:19 +0000 +Subject: Remove auth header upon cross origin redirect + +--- + .../blink/renderer/platform/loader/fetch/resource_loader.cc | 3 +++ + .../platform/loader/fetch/url_loader/sync_load_context.cc | 3 +++ + 2 files changed, 6 insertions(+) + +diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc b/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc +--- a/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc ++++ b/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc +@@ -812,6 +812,9 @@ bool ResourceLoader::WillFollowRedirect( + new_url)) { + fetcher_->GetUseCounter().CountUse( + mojom::WebFeature::kAuthorizationCrossOrigin); ++ if (removed_headers) { ++ removed_headers->push_back(net::HttpRequestHeaders::kAuthorization); ++ } + } + + if (removed_headers) { +diff --git a/third_party/blink/renderer/platform/loader/fetch/url_loader/sync_load_context.cc b/third_party/blink/renderer/platform/loader/fetch/url_loader/sync_load_context.cc +--- a/third_party/blink/renderer/platform/loader/fetch/url_loader/sync_load_context.cc ++++ b/third_party/blink/renderer/platform/loader/fetch/url_loader/sync_load_context.cc +@@ -172,6 +172,9 @@ bool SyncLoadContext::OnReceivedRedirect( + if (has_authorization_header_ && + !url::IsSameOriginWith(response_->url, redirect_info.new_url)) { + response_->has_authorization_header_between_cross_origin_redirect_ = true; ++ if (removed_headers) { ++ removed_headers->push_back(net::HttpRequestHeaders::kAuthorization); ++ } + } + + if (removed_headers) { +-- +2.25.1