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

Unified Diff: extensions/common/csp_validator.h

Issue 760513003: Only allow insecure object-src directives for whitelisted mime types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@extensions-csp3
Patch Set: Created 6 years, 1 month 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 | « no previous file | extensions/common/csp_validator.cc » ('j') | extensions/common/csp_validator.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/csp_validator.h
diff --git a/extensions/common/csp_validator.h b/extensions/common/csp_validator.h
index e7446f6d4fd885f0363d7002f9d780053e3ab7ba..e8aa78c4ca3dc33b1ff8b102379172320588c91c 100644
--- a/extensions/common/csp_validator.h
+++ b/extensions/common/csp_validator.h
@@ -18,6 +18,19 @@ namespace csp_validator {
// will cause problems when we transmit the policy in an HTTP header.
bool ContentSecurityPolicyIsLegal(const std::string& policy);
+// This specifies options for configuring which CSP directives are permitted in
+// extensions.
+enum Options {
+ OPTIONS_NONE = 0,
+ // Allows 'unsafe-eval' to be specified as a source in a directive.
+ OPTIONS_ALLOW_UNSAFE_EVAL = 1 << 0,
+ // Allow an object-src to be specified with any sources (i.e. it may contain
+ // wildcards or http sources). Specifying this requires the CSP to contain
+ // a plugin-types directive which restricts the plugins that can be loaded
+ // to those which are fully sandboxed.
+ OPTIONS_ALLOW_INSECURE_OBJECT_SRC = 1 << 1,
+};
+
// Checks whether the given |policy| meets the minimum security requirements
// for use in the extension system.
//
@@ -28,8 +41,10 @@ bool ContentSecurityPolicyIsLegal(const std::string& policy);
// However, we found that it broke too many deployed extensions to limit
// 'unsafe-eval' in the script-src directive, so that is allowed as a special
// case for extensions. Platform apps disallow it.
+//
+// |options| is a bitmask of Options.
bool ContentSecurityPolicyIsSecure(
- const std::string& policy, Manifest::Type type);
+ const std::string& policy, int options);
// Checks whether the given |policy| enforces a unique origin sandbox as
// defined by http://www.whatwg.org/specs/web-apps/current-work/multipage/
« no previous file with comments | « no previous file | extensions/common/csp_validator.cc » ('j') | extensions/common/csp_validator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698