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

Unified Diff: Source/core/dom/DocumentInit.cpp

Issue 845303003: Tag SecurityContext objects as being hosted in reserved IP ranges. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Skip 'about:blank', 'swappedout://', etc. Created 5 years, 11 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
Index: Source/core/dom/DocumentInit.cpp
diff --git a/Source/core/dom/DocumentInit.cpp b/Source/core/dom/DocumentInit.cpp
index 1aa80ce299c02316582a410b315dbbbe9d8b6a63..1619d93ef3819d81171b98cb31391cadf2b7d40f 100644
--- a/Source/core/dom/DocumentInit.cpp
+++ b/Source/core/dom/DocumentInit.cpp
@@ -33,7 +33,9 @@
#include "core/frame/LocalFrame.h"
#include "core/html/HTMLFrameOwnerElement.h"
#include "core/html/imports/HTMLImportsController.h"
+#include "core/loader/DocumentLoader.h"
#include "platform/RuntimeEnabledFeatures.h"
+#include "public/platform/Platform.h"
namespace blink {
@@ -123,6 +125,20 @@ bool DocumentInit::shouldEnforceStrictMixedContentChecking() const
return frameForSecurityContext()->loader().shouldEnforceStrictMixedContentChecking();
}
+bool DocumentInit::isHostedInReservedIPRange() const
+{
+ if (LocalFrame* frame = frameForSecurityContext()) {
+ // TODO: Fix the platform API to drop the KURL construction.
jochen (gone - plz use gerrit) 2015/01/13 15:04:55 it's FIXME in blink
Mike West 2015/01/13 15:35:38 Done.
+ if (DocumentLoader* loader = frame->loader().provisionalDocumentLoader() ? frame->loader().provisionalDocumentLoader() : frame->loader().documentLoader()) {
+ if (!loader->response().remoteIPAddress().isEmpty()) {
+ KURL documentIP(ParsedURLString, "http://" + loader->response().remoteIPAddress());
jochen (gone - plz use gerrit) 2015/01/13 15:04:54 https:// - be a good role model :) otoh, why does
Mike West 2015/01/13 15:35:38 Ha! Done.
+ return Platform::current()->isReservedIPAddress(documentIP);
+ }
+ }
+ }
+ return false;
+}
+
Settings* DocumentInit::settings() const
{
ASSERT(frameForSecurityContext());

Powered by Google App Engine
This is Rietveld 408576698