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

Unified Diff: extensions/common/csp_validator_unittest.cc

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 | « extensions/common/csp_validator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/csp_validator_unittest.cc
diff --git a/extensions/common/csp_validator_unittest.cc b/extensions/common/csp_validator_unittest.cc
index 9e2d800f99ea5fb799f3b1e3f953787837ed5117..1afa0b1a3f387f40d138e3df09215a6d7a2b9138 100644
--- a/extensions/common/csp_validator_unittest.cc
+++ b/extensions/common/csp_validator_unittest.cc
@@ -180,19 +180,34 @@ TEST(ExtensionCSPValidator, IsSecure) {
EXPECT_FALSE(ContentSecurityPolicyIsSecure(
"script-src 'self'; object-src *", OPTIONS_NONE));
- EXPECT_TRUE(ContentSecurityPolicyIsSecure(
+ EXPECT_FALSE(ContentSecurityPolicyIsSecure(
"script-src 'self'; object-src *", OPTIONS_ALLOW_INSECURE_OBJECT_SRC));
EXPECT_TRUE(ContentSecurityPolicyIsSecure(
- "script-src 'self'; object-src http://www.example.com",
+ "script-src 'self'; object-src *; plugin-types application/pdf",
+ OPTIONS_ALLOW_INSECURE_OBJECT_SRC));
+ EXPECT_FALSE(ContentSecurityPolicyIsSecure(
+ "script-src 'self'; object-src *; "
+ "plugin-types application/x-shockwave-flash",
+ OPTIONS_ALLOW_INSECURE_OBJECT_SRC));
+ EXPECT_FALSE(ContentSecurityPolicyIsSecure(
+ "script-src 'self'; object-src *; "
+ "plugin-types application/x-shockwave-flash application/pdf",
+ OPTIONS_ALLOW_INSECURE_OBJECT_SRC));
+ EXPECT_TRUE(ContentSecurityPolicyIsSecure(
+ "script-src 'self'; object-src http://www.example.com; "
+ "plugin-types application/pdf",
OPTIONS_ALLOW_INSECURE_OBJECT_SRC));
EXPECT_TRUE(ContentSecurityPolicyIsSecure(
- "object-src http://www.example.com blob:; script-src 'self'",
+ "object-src http://www.example.com blob:; script-src 'self'; "
+ "plugin-types application/pdf",
OPTIONS_ALLOW_INSECURE_OBJECT_SRC));
EXPECT_TRUE(ContentSecurityPolicyIsSecure(
- "script-src 'self'; object-src http://*.example.com",
+ "script-src 'self'; object-src http://*.example.com; "
+ "plugin-types application/pdf",
OPTIONS_ALLOW_INSECURE_OBJECT_SRC));
EXPECT_FALSE(ContentSecurityPolicyIsSecure(
- "script-src *; object-src *;", OPTIONS_ALLOW_INSECURE_OBJECT_SRC));
+ "script-src *; object-src *; plugin-types application/pdf",
+ OPTIONS_ALLOW_INSECURE_OBJECT_SRC));
}
TEST(ExtensionCSPValidator, IsSandboxed) {
« no previous file with comments | « extensions/common/csp_validator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698