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

Unified Diff: content/browser/child_process_security_policy_unittest.cc

Issue 2365433002: (re-land) Disallow navigations to blob URLs with non-canonical origins. (Closed)
Patch Set: Remove newline Created 4 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 | « content/browser/child_process_security_policy_impl.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/child_process_security_policy_unittest.cc
diff --git a/content/browser/child_process_security_policy_unittest.cc b/content/browser/child_process_security_policy_unittest.cc
index 24aa45bc21f050f00bea4642e7f5fe50674589a6..ea722fcd95416cf168ffc1e2745896126ea56bfc 100644
--- a/content/browser/child_process_security_policy_unittest.cc
+++ b/content/browser/child_process_security_policy_unittest.cc
@@ -186,6 +186,58 @@ TEST_F(ChildProcessSecurityPolicyTest, StandardSchemesTest) {
p->Remove(kRendererID);
}
+TEST_F(ChildProcessSecurityPolicyTest, BlobSchemeTest) {
+ ChildProcessSecurityPolicyImpl* p =
+ ChildProcessSecurityPolicyImpl::GetInstance();
+
+ p->Add(kRendererID);
+
+ EXPECT_TRUE(
+ p->CanRequestURL(kRendererID, GURL("blob:http://localhost/some-guid")));
+ EXPECT_TRUE(p->CanRequestURL(kRendererID, GURL("blob:null/some-guid")));
+ EXPECT_TRUE(
+ p->CanRequestURL(kRendererID, GURL("blob:http://localhost/some-guid")));
+ EXPECT_TRUE(p->CanRequestURL(kRendererID, GURL("blob:NulL/some-guid")));
+ EXPECT_TRUE(
+ p->CanRequestURL(kRendererID, GURL("blob:NulL/some-guid#fragment")));
+ EXPECT_TRUE(p->CanRequestURL(kRendererID, GURL("blob:NulL/some-guid?query")));
+ EXPECT_TRUE(
+ p->CanRequestURL(kRendererID, GURL("blob:blobinternal://some-guid")));
+ EXPECT_FALSE(p->CanRequestURL(
+ kRendererID, GURL("blob:http://username@localhost/some-guid")));
+ EXPECT_FALSE(p->CanRequestURL(
+ kRendererID, GURL("blob:http://username @localhost/some-guid")));
+ EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("blob:blob:some-guid")));
+ EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("blob:some-guid")));
+ EXPECT_FALSE(p->CanRequestURL(kRendererID,
+ GURL("blob:filesystem:http://localhost/path")));
+ EXPECT_FALSE(p->CanRequestURL(kRendererID,
+ GURL("filesystem:blob:http://localhost/guid")));
+
+ EXPECT_TRUE(
+ p->CanCommitURL(kRendererID, GURL("blob:http://localhost/some-guid")));
+ EXPECT_TRUE(p->CanCommitURL(kRendererID, GURL("blob:null/some-guid")));
+ EXPECT_TRUE(
+ p->CanCommitURL(kRendererID, GURL("blob:http://localhost/some-guid")));
+ EXPECT_TRUE(p->CanCommitURL(kRendererID, GURL("blob:NulL/some-guid")));
+ EXPECT_TRUE(
+ p->CanCommitURL(kRendererID, GURL("blob:NulL/some-guid#fragment")));
+ EXPECT_TRUE(
+ p->CanCommitURL(kRendererID, GURL("blob:blobinternal://some-guid")));
+ EXPECT_FALSE(p->CanCommitURL(
+ kRendererID, GURL("blob:http://username@localhost/some-guid")));
+ EXPECT_FALSE(p->CanCommitURL(
+ kRendererID, GURL("blob:http://username @localhost/some-guid")));
+ EXPECT_FALSE(p->CanCommitURL(kRendererID, GURL("blob:blob:some-guid")));
+ EXPECT_FALSE(p->CanCommitURL(kRendererID, GURL("blob:some-guid")));
+ EXPECT_FALSE(p->CanCommitURL(kRendererID,
+ GURL("blob:filesystem:http://localhost/path")));
+ EXPECT_FALSE(p->CanCommitURL(kRendererID,
+ GURL("filesystem:blob:http://localhost/guid")));
+
+ p->Remove(kRendererID);
+}
+
TEST_F(ChildProcessSecurityPolicyTest, AboutTest) {
ChildProcessSecurityPolicyImpl* p =
ChildProcessSecurityPolicyImpl::GetInstance();
« no previous file with comments | « content/browser/child_process_security_policy_impl.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698