Commit 30e50858 authored by Daniel Rubery's avatar Daniel Rubery Committed by Commit Bot

Use distinct URLs for WebProtect vs APP deep scanning

To accommodate a possible need to separate these handlers on the
backend, Chrome will send APP deep scans to a different URL than
WebProtect deep scans.

Bug: 1020418
Change-Id: Icf859f1d746118a16de1677e74e27bf50593a37d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2024697Reviewed-by: default avatarXinghui Lu <xinghuilu@chromium.org>
Commit-Queue: Daniel Rubery <drubery@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736087}
parent 9235d01e
......@@ -36,9 +36,12 @@ namespace {
const int kScanningTimeoutSeconds = 5 * 60; // 5 minutes
const char kSbBinaryUploadUrl[] =
const char kSbEnterpriseUploadUrl[] =
"https://safebrowsing.google.com/safebrowsing/uploads/scan";
const char kSbAppUploadUrl[] =
"https://safebrowsing.google.com/safebrowsing/uploads/app";
bool IsAdvancedProtectionRequest(const BinaryUploadService::Request& request) {
return !request.deep_scanning_request().has_dlp_scan_request() &&
request.deep_scanning_request().has_malware_scan_request() &&
......@@ -209,8 +212,8 @@ void BinaryUploadService::OnGetRequestData(Request* request,
base::Base64Encode(metadata, &metadata);
auto upload_request = MultipartUploadRequest::Create(
url_loader_factory_, GURL(kSbBinaryUploadUrl), metadata, data.contents,
traffic_annotation,
url_loader_factory_, GetUploadUrl(IsAdvancedProtectionRequest(*request)),
metadata, data.contents, traffic_annotation,
base::BindOnce(&BinaryUploadService::OnUploadComplete,
weakptr_factory_.GetWeakPtr(), request));
upload_request->Start();
......@@ -465,8 +468,9 @@ void BinaryUploadService::SetAuthForTesting(bool authorized) {
}
// static
GURL BinaryUploadService::GetUploadUrl() {
return GURL(kSbBinaryUploadUrl);
GURL BinaryUploadService::GetUploadUrl(bool is_advanced_protection) {
return is_advanced_protection ? GURL(kSbAppUploadUrl)
: GURL(kSbEnterpriseUploadUrl);
}
} // namespace safe_browsing
......@@ -149,8 +149,9 @@ class BinaryUploadService {
// Sets |can_upload_data_| for tests.
void SetAuthForTesting(bool authorized);
// Returns the URL that requests are uploaded to.
static GURL GetUploadUrl();
// Returns the URL that requests are uploaded to. Scans for enterprise go to a
// different URL than scans for Advanced Protection users.
static GURL GetUploadUrl(bool is_advanced_protection_request);
private:
friend class BinaryUploadServiceTest;
......
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