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

Unified Diff: extensions/common/csp_validator.h

Issue 754713002: Allow arbitrary object-src CSP directives for component extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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') | no next file with comments »
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..192f898c8664c8a2db70158a5b38225ad9ab0d73 100644
--- a/extensions/common/csp_validator.h
+++ b/extensions/common/csp_validator.h
@@ -18,6 +18,17 @@ 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).
+ 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 +39,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698