Commit 3c6a7577 authored by Ali Juma's avatar Ali Juma Committed by Commit Bot

Add a feature for limiting Safe Browsing database size on iOS

This adds a feature that limits the number of entries in
each Safe Browsing list to 2^{18}, which can be used to
measure the impact of limiting the size of the Safe
Browsing database.

Change-Id: Ieef0697ca60e6cd2c65e13b32b425a6ce08c0844
Bug: 1127429
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2402112
Commit-Queue: Ali Juma <ajuma@chromium.org>
Reviewed-by: default avatarVarun Khaneja <vakh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806677}
parent 17546f7d
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/rand_util.h" #include "base/rand_util.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "build/build_config.h"
#include "components/safe_browsing/buildflags.h" #include "components/safe_browsing/buildflags.h"
#include "components/safe_browsing/core/db/safebrowsing.pb.h" #include "components/safe_browsing/core/db/safebrowsing.pb.h"
#include "components/safe_browsing/core/features.h" #include "components/safe_browsing/core/features.h"
...@@ -76,6 +77,12 @@ static const int kV4TimerStartIntervalSecMax = 300; ...@@ -76,6 +77,12 @@ static const int kV4TimerStartIntervalSecMax = 300;
// Maximum time, in seconds, to wait for a response to an update request. // Maximum time, in seconds, to wait for a response to an update request.
static const int kV4TimerUpdateWaitSecMax = 15 * 60; // 15 minutes static const int kV4TimerUpdateWaitSecMax = 15 * 60; // 15 minutes
#if defined(OS_IOS)
// Maximum number of entries in each list, when the limited list size experiment
// is enabled.
static const int kMaximumEntriesPerList = 1 << 18;
#endif
ChromeClientInfo::SafeBrowsingReportingPopulation GetReportingLevelProtoValue( ChromeClientInfo::SafeBrowsingReportingPopulation GetReportingLevelProtoValue(
ExtendedReportingLevel reporting_level) { ExtendedReportingLevel reporting_level) {
switch (reporting_level) { switch (reporting_level) {
...@@ -242,6 +249,13 @@ std::string V4UpdateProtocolManager::GetBase64SerializedUpdateRequestProto() { ...@@ -242,6 +249,13 @@ std::string V4UpdateProtocolManager::GetBase64SerializedUpdateRequestProto() {
list_update_request->mutable_constraints()->add_supported_compressions(RAW); list_update_request->mutable_constraints()->add_supported_compressions(RAW);
list_update_request->mutable_constraints()->add_supported_compressions( list_update_request->mutable_constraints()->add_supported_compressions(
RICE); RICE);
#if defined(OS_IOS)
if (base::FeatureList::IsEnabled(kLimitedListSizeForIOS)) {
list_update_request->mutable_constraints()->set_max_database_entries(
kMaximumEntriesPerList);
}
#endif
} }
if (!extended_reporting_level_callback_.is_null()) { if (!extended_reporting_level_callback_.is_null()) {
......
...@@ -62,6 +62,9 @@ const base::Feature kEnhancedProtection { ...@@ -62,6 +62,9 @@ const base::Feature kEnhancedProtection {
#endif #endif
}; };
const base::Feature kLimitedListSizeForIOS{"SafeBrowsingLimitedListSizeForIOS",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kMalwareScanEnabled{"SafeBrowsingMalwareScanEnabled", const base::Feature kMalwareScanEnabled{"SafeBrowsingMalwareScanEnabled",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
...@@ -168,6 +171,7 @@ constexpr struct { ...@@ -168,6 +171,7 @@ constexpr struct {
{&kDelayedWarnings, true}, {&kDelayedWarnings, true},
{&kDownloadRequestWithToken, true}, {&kDownloadRequestWithToken, true},
{&kEnhancedProtection, true}, {&kEnhancedProtection, true},
{&kLimitedListSizeForIOS, true},
{&kMalwareScanEnabled, true}, {&kMalwareScanEnabled, true},
{&kPasswordProtectionForSavedPasswords, true}, {&kPasswordProtectionForSavedPasswords, true},
{&kPasswordProtectionShowDomainsForSavedPasswords, true}, {&kPasswordProtectionShowDomainsForSavedPasswords, true},
......
...@@ -49,6 +49,10 @@ extern const base::Feature kDownloadRequestWithToken; ...@@ -49,6 +49,10 @@ extern const base::Feature kDownloadRequestWithToken;
// Enable Chrome Safe Browsing enhanced protection. // Enable Chrome Safe Browsing enhanced protection.
extern const base::Feature kEnhancedProtection; extern const base::Feature kEnhancedProtection;
// Controls whether the limited list size experiment is enabled. This experiment
// limits the number of entries stored in each Safe Browsing list.
extern const base::Feature kLimitedListSizeForIOS;
// Controls whether to do deep scanning for malware. If both this feature and // Controls whether to do deep scanning for malware. If both this feature and
// the enterprise policies are enabled, the downloaded and uploaded files are // the enterprise policies are enabled, the downloaded and uploaded files are
// sent for scanning. // sent for scanning.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment