Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Unified Diff: extensions/common/csp_validator.cc

Issue 2574763003: Remove chrome-extension-resource:// scheme (Closed)
Patch Set: Remove BUILD reference to resources/extension outdir. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/common/constants.cc ('k') | extensions/common/csp_validator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/csp_validator.cc
diff --git a/extensions/common/csp_validator.cc b/extensions/common/csp_validator.cc
index e6c789f6f8e59fce0d2afdc732efac15d82a37f6..37d1009d69415db9a2e19ca72aa8840166c6692a 100644
--- a/extensions/common/csp_validator.cc
+++ b/extensions/common/csp_validator.cc
@@ -31,8 +31,7 @@ const char kObjectSrc[] = "object-src";
const char kPluginTypes[] = "plugin-types";
const char kObjectSrcDefaultDirective[] = "object-src 'self';";
-const char kScriptSrcDefaultDirective[] =
- "script-src 'self' chrome-extension-resource:;";
+const char kScriptSrcDefaultDirective[] = "script-src 'self';";
const char kSandboxDirectiveName[] = "sandbox";
const char kAllowSameOriginToken[] = "allow-same-origin";
@@ -176,13 +175,18 @@ void GetSecureDirectiveValues(const std::string& directive_name,
std::string(extensions::kExtensionScheme) +
url::kStandardSchemeSeparator,
false) ||
- IsHashSource(source_literal) ||
- base::StartsWith(source_lower, "chrome-extension-resource:",
- base::CompareCase::SENSITIVE)) {
+ IsHashSource(source_literal)) {
is_secure_csp_token = true;
} else if ((options & OPTIONS_ALLOW_UNSAFE_EVAL) &&
source_lower == "'unsafe-eval'") {
is_secure_csp_token = true;
+ } else if (base::StartsWith(source_lower, "chrome-extension-resource:",
+ base::CompareCase::SENSITIVE)) {
+ // The "chrome-extension-resource" scheme has been removed from the
+ // codebase, but it may still appear in existing CSPs. We continue to
+ // allow it here for compatibility. Requests on this scheme will not
+ // return any kind of network response.
+ is_secure_csp_token = true;
}
if (is_secure_csp_token) {
« no previous file with comments | « extensions/common/constants.cc ('k') | extensions/common/csp_validator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698