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 @@
#include "base/metrics/histogram_macros.h"
#include "base/rand_util.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
#include "components/safe_browsing/buildflags.h"
#include "components/safe_browsing/core/db/safebrowsing.pb.h"
#include "components/safe_browsing/core/features.h"
......@@ -76,6 +77,12 @@ static const int kV4TimerStartIntervalSecMax = 300;
// Maximum time, in seconds, to wait for a response to an update request.
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(
ExtendedReportingLevel reporting_level) {
switch (reporting_level) {
......@@ -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(
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()) {
......
......@@ -62,6 +62,9 @@ const base::Feature kEnhancedProtection {
#endif
};
const base::Feature kLimitedListSizeForIOS{"SafeBrowsingLimitedListSizeForIOS",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kMalwareScanEnabled{"SafeBrowsingMalwareScanEnabled",
base::FEATURE_DISABLED_BY_DEFAULT};
......@@ -168,6 +171,7 @@ constexpr struct {
{&kDelayedWarnings, true},
{&kDownloadRequestWithToken, true},
{&kEnhancedProtection, true},
{&kLimitedListSizeForIOS, true},
{&kMalwareScanEnabled, true},
{&kPasswordProtectionForSavedPasswords, true},
{&kPasswordProtectionShowDomainsForSavedPasswords, true},
......
......@@ -49,6 +49,10 @@ extern const base::Feature kDownloadRequestWithToken;
// Enable Chrome Safe Browsing enhanced protection.
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
// the enterprise policies are enabled, the downloaded and uploaded files are
// 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