Skip to content

Commit

Permalink
AppCache: Mark security fix as disabled by default
Browse files Browse the repository at this point in the history
(cherry picked from commit b7ad7e0)

Bug: 999001
Change-Id: I3007b17feee16c11fe3d71138a865dbadfc4125b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1973351
Commit-Queue: Chase Phillips <cmp@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Auto-Submit: Chase Phillips <cmp@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#725826}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1973552
Reviewed-by: Krishna Govind <govind@chromium.org>
Reviewed-by: Chase Phillips <cmp@chromium.org>
Commit-Queue: Krishna Govind <govind@chromium.org>
Cr-Commit-Position: refs/branch-heads/4000@{#3}
Cr-Branched-From: e91ca02-refs/heads/master@{#725795}
  • Loading branch information
chasephillips authored and Krishna Govind committed Dec 18, 2019
1 parent 3f82664 commit 3cc2cbc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
7 changes: 3 additions & 4 deletions content/browser/appcache/appcache_update_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/compiler_specific.h"
#include "base/feature_list.h"
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_util.h"
Expand All @@ -34,9 +33,6 @@ namespace {
const int kAppCacheFetchBufferSize = 32768;
const size_t kMaxConcurrentUrlFetches = 2;

const base::Feature kAppCacheManifestScopeChecksFeature{
"AppCacheManifestScopeChecks", base::FEATURE_ENABLED_BY_DEFAULT};

std::string FormatUrlErrorMessage(
const char* format, const GURL& url,
AppCacheUpdateJob::ResultType error,
Expand Down Expand Up @@ -177,6 +173,9 @@ int64_t ComputeAppCacheResponsePadding(const GURL& response_url,

} // namespace

const base::Feature kAppCacheManifestScopeChecksFeature{
"AppCacheManifestScopeChecks", base::FEATURE_DISABLED_BY_DEFAULT};

// Helper class for collecting hosts per frontend when sending notifications
// so that only one notification is sent for all hosts using the same frontend.
class HostNotifier {
Expand Down
3 changes: 3 additions & 0 deletions content/browser/appcache/appcache_update_job.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <vector>

#include "base/containers/circular_deque.h"
#include "base/feature_list.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
Expand Down Expand Up @@ -42,6 +43,8 @@ class AppCacheUpdateJobTest;

class HostNotifier;

CONTENT_EXPORT extern const base::Feature kAppCacheManifestScopeChecksFeature;

// Application cache Update algorithm and state.
class CONTENT_EXPORT AppCacheUpdateJob
: public AppCacheStorage::Delegate,
Expand Down
21 changes: 21 additions & 0 deletions content/browser/appcache/appcache_update_job_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "base/strings/stringprintf.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/post_task.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/browser/appcache/appcache_group.h"
Expand Down Expand Up @@ -1057,6 +1058,8 @@ class AppCacheUpdateJobTest : public testing::Test,
}

void UpgradeManifestDataChangedScopeUnchangedTest() {
base::test::ScopedFeatureList f;
f.InitAndEnableFeature(kAppCacheManifestScopeChecksFeature);
MakeService();
// URL path /files/manifest2-with-root-override has a cached scope of "/".
// The path has a scope override of "/", so the fetched scope will be "/"
Expand Down Expand Up @@ -1142,6 +1145,8 @@ class AppCacheUpdateJobTest : public testing::Test,
}

void UpgradeManifestDataChangedScopeChangedTest() {
base::test::ScopedFeatureList f;
f.InitAndEnableFeature(kAppCacheManifestScopeChecksFeature);
MakeService();
// URL path /files/manifest2 has a cached scope of "/". The path has no
// scope override, so the fetched scope will be "/files/" and a scope change
Expand Down Expand Up @@ -1218,6 +1223,8 @@ class AppCacheUpdateJobTest : public testing::Test,
}

void UpgradeManifestDataUnchangedScopeUnchangedTest() {
base::test::ScopedFeatureList f;
f.InitAndEnableFeature(kAppCacheManifestScopeChecksFeature);
MakeService();
// URL path /files/manifest2-with-root-override has a cached scope of "/".
// The path has a scope override of "/", so the fetched scope will be "/"
Expand Down Expand Up @@ -1271,6 +1278,8 @@ class AppCacheUpdateJobTest : public testing::Test,
}

void UpgradeManifestDataUnchangedScopeChangedTest() {
base::test::ScopedFeatureList f;
f.InitAndEnableFeature(kAppCacheManifestScopeChecksFeature);
MakeService();
// URL path /files/manifest2 has a cached scope of "/". The path has no
// scope override, so the fetched scope will be "/files/" and a scope change
Expand Down Expand Up @@ -3349,6 +3358,8 @@ class AppCacheUpdateJobTest : public testing::Test,
// has a response info with cached Last-Modified headers, the request does not
// include an If-Modified-Since conditioanl header.
void IfModifiedSinceUpgradeParserVersion0Test() {
base::test::ScopedFeatureList f;
f.InitAndEnableFeature(kAppCacheManifestScopeChecksFeature);
HttpHeadersRequestTestJob::Initialize(std::string(), std::string(),
/*headers_allowed=*/false);

Expand Down Expand Up @@ -3415,6 +3426,8 @@ class AppCacheUpdateJobTest : public testing::Test,
}

void IfModifiedSinceUpgradeParserVersion1Test() {
base::test::ScopedFeatureList f;
f.InitAndEnableFeature(kAppCacheManifestScopeChecksFeature);
HttpHeadersRequestTestJob::Initialize("Sat, 29 Oct 1994 19:43:31 GMT",
std::string());

Expand Down Expand Up @@ -3485,6 +3498,8 @@ class AppCacheUpdateJobTest : public testing::Test,
// has a response info with cached ETag headers, the request does not include
// an If-None-Match conditioanl header.
void IfNoneMatchUpgradeParserVersion0Test() {
base::test::ScopedFeatureList f;
f.InitAndEnableFeature(kAppCacheManifestScopeChecksFeature);
HttpHeadersRequestTestJob::Initialize(std::string(), std::string(),
/*headers_allowed=*/false);

Expand Down Expand Up @@ -3551,6 +3566,8 @@ class AppCacheUpdateJobTest : public testing::Test,
}

void IfNoneMatchUpgradeParserVersion1Test() {
base::test::ScopedFeatureList f;
f.InitAndEnableFeature(kAppCacheManifestScopeChecksFeature);
HttpHeadersRequestTestJob::Initialize(std::string(), "\"LadeDade\"");

MakeService();
Expand Down Expand Up @@ -4391,6 +4408,8 @@ class AppCacheUpdateJobTest : public testing::Test,

void ScopeTest(const char* tested_manifest_path,
const TestedManifest& tested_manifest) {
base::test::ScopedFeatureList f;
f.InitAndEnableFeature(kAppCacheManifestScopeChecksFeature);
GURL manifest_url = MockHttpServer::GetMockUrl(tested_manifest_path);

MakeService();
Expand Down Expand Up @@ -4431,6 +4450,8 @@ class AppCacheUpdateJobTest : public testing::Test,
void Scope304Test(const char* tested_manifest_path,
const std::string& previous_scope,
const TestedManifest& tested_manifest) {
base::test::ScopedFeatureList f;
f.InitAndEnableFeature(kAppCacheManifestScopeChecksFeature);
GURL manifest_url = MockHttpServer::GetMockUrl(tested_manifest_path);

MakeService();
Expand Down

0 comments on commit 3cc2cbc

Please sign in to comment.