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

Unified Diff: Source/core/loader/MixedContentChecker.cpp

Issue 564123002: Measure resources from private IP addresses in public websites. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | « Source/core/loader/MixedContentChecker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/MixedContentChecker.cpp
diff --git a/Source/core/loader/MixedContentChecker.cpp b/Source/core/loader/MixedContentChecker.cpp
index b358b2e80b057487a892b41a99c280f9f871d3b9..3247dc615dfc1deb3bb7835c9a8286547b3ec4b7 100644
--- a/Source/core/loader/MixedContentChecker.cpp
+++ b/Source/core/loader/MixedContentChecker.cpp
@@ -34,6 +34,7 @@
#include "core/frame/Settings.h"
#include "core/frame/UseCounter.h"
#include "core/inspector/ConsoleMessage.h"
+#include "core/loader/DocumentLoader.h"
#include "core/loader/FrameLoader.h"
#include "core/loader/FrameLoaderClient.h"
#include "platform/RuntimeEnabledFeatures.h"
@@ -344,4 +345,22 @@ bool MixedContentChecker::checkFormAction(LocalFrame* frame, const KURL& url)
return true;
}
+bool MixedContentChecker::checkMixedPrivatePublic(LocalFrame* frame, const AtomicString& resourceIPAddress)
cbentzel 2014/09/12 15:41:10 return bool is not being used. Probably want to e
Mike West 2014/09/13 04:04:33 Dropped the bool. If/when we decide to start block
+{
+ if (!frame || !frame->document() || !frame->document()->loader())
+ return false;
+
+ KURL documentIP(ParsedURLString, "http://" + frame->document()->loader()->response().remoteIPAddress());
+ KURL resourceIP(ParsedURLString, "http://" + resourceIPAddress);
+
+ // Just count these for the moment, don't block them.
+ //
+ // FIXME: Once we know how we want to check this, adjust the platform APIs to avoid the KURL construction.
+ if (Platform::current()->isReservedIPAddress(resourceIP) && !Platform::current()->isReservedIPAddress(documentIP)) {
+ UseCounter::count(frame->document(), UseCounter::MixedContentPrivateHostnameInPublicHostname);
+ return true;
+ }
+ return false;
+}
+
} // namespace blink
« no previous file with comments | « Source/core/loader/MixedContentChecker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698