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

Unified Diff: third_party/WebKit/Source/core/frame/csp/CSPSourceListTest.cpp

Issue 1361763005: Disallow CSP source * matching of data:, blob:, and filesystem: URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Better extensions fix Created 5 years, 3 months 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 | « third_party/WebKit/Source/core/frame/csp/CSPSourceList.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/csp/CSPSourceListTest.cpp
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPSourceListTest.cpp b/third_party/WebKit/Source/core/frame/csp/CSPSourceListTest.cpp
index 7c49fe2cffb438fbc978d700342b4524809c715a..19ca8a7b42a7b79f45b7fe51693d69c757976c16 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPSourceListTest.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/CSPSourceListTest.cpp
@@ -54,6 +54,24 @@ TEST_F(CSPSourceListTest, BasicMatchingNone)
EXPECT_FALSE(sourceList.matches(KURL(base, "https://example.test/")));
}
+TEST_F(CSPSourceListTest, BasicMatchingStar)
+{
+ KURL base;
+ String sources = "*";
+ CSPSourceList sourceList(csp.get(), "script-src");
+ parseSourceList(sourceList, sources);
+
+ EXPECT_TRUE(sourceList.matches(KURL(base, "http://example.com/")));
+ EXPECT_TRUE(sourceList.matches(KURL(base, "https://example.com/")));
+ EXPECT_TRUE(sourceList.matches(KURL(base, "http://example.com/bar")));
+ EXPECT_TRUE(sourceList.matches(KURL(base, "http://foo.example.com/")));
+ EXPECT_TRUE(sourceList.matches(KURL(base, "http://foo.example.com/bar")));
+
+ EXPECT_FALSE(sourceList.matches(KURL(base, "data:https://example.test/")));
+ EXPECT_FALSE(sourceList.matches(KURL(base, "blob:https://example.test/")));
+ EXPECT_FALSE(sourceList.matches(KURL(base, "filesystem:https://example.test/")));
+}
+
TEST_F(CSPSourceListTest, BasicMatchingSelf)
{
KURL base;
« no previous file with comments | « third_party/WebKit/Source/core/frame/csp/CSPSourceList.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698