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

Unified Diff: Source/WebCore/page/SecurityOrigin.cpp

Issue 8198008: Merge 96610 - Resource loader should block HTTP redirects to local resources (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/874/
Patch Set: Created 9 years, 2 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 | « Source/WebCore/loader/MainResourceLoader.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/page/SecurityOrigin.cpp
===================================================================
--- Source/WebCore/page/SecurityOrigin.cpp (revision 96956)
+++ Source/WebCore/page/SecurityOrigin.cpp (working copy)
@@ -331,10 +331,33 @@
return isAccessWhiteListed(targetOrigin.get());
}
+// This is a hack to allow keep navigation to http/https feeds working. To remove this
+// we need to introduce new API akin to registerURLSchemeAsLocal, that registers a
+// protocols navigation policy.
+// feed(|s|search): is considered a 'nesting' scheme by embedders that support it, so it can be
+// local or remote depending on what is nested. Currently we just check if we are nesting
+// http or https, otherwise we ignore the nesting for the purpose of a security check. We need
+// a facility for registering nesting schemes, and some generalized logic for them.
+// This function should be removed as an outcome of https://bugs.webkit.org/show_bug.cgi?id=69196
+static bool isFeedWithNestedProtocolInHTTPFamily(const KURL& url)
+{
+ const String& urlString = url.string();
+ if (!urlString.startsWith("feed", false))
+ return false;
+
+ return urlString.startsWith("feed://", false)
+ || urlString.startsWith("feed:http:", false) || urlString.startsWith("feed:https:", false)
+ || urlString.startsWith("feeds:http:", false) || urlString.startsWith("feeds:https:", false)
+ || urlString.startsWith("feedsearch:http:", false) || urlString.startsWith("feedsearch:https:", false);
+}
+
bool SecurityOrigin::canDisplay(const KURL& url) const
{
String protocol = url.protocol().lower();
+ if (isFeedWithNestedProtocolInHTTPFamily(url))
+ return true;
+
if (SchemeRegistry::canDisplayOnlyIfCanRequest(protocol))
return canRequest(url);
« no previous file with comments | « Source/WebCore/loader/MainResourceLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698