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

Unified Diff: third_party/WebKit/Source/core/loader/PingLoader.cpp

Issue 2500023002: <a ping="..."> should be covered by connect-src CSP directive. (Closed)
Patch Set: Created 4 years, 1 month 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/LayoutTests/http/tests/security/contentSecurityPolicy/connect-src-anchor-ping-expected.txt ('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/loader/PingLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/PingLoader.cpp b/third_party/WebKit/Source/core/loader/PingLoader.cpp
index eed8f67f6693885017d45206ad8931252fdc8f22..3086e7e4131c20c8ea16995bcf5e54e7372617a5 100644
--- a/third_party/WebKit/Source/core/loader/PingLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/PingLoader.cpp
@@ -33,6 +33,7 @@
#include "core/dom/DOMArrayBufferView.h"
#include "core/dom/Document.h"
+#include "core/dom/SecurityContext.h"
#include "core/fetch/CrossOriginAccessControl.h"
#include "core/fetch/FetchContext.h"
#include "core/fetch/FetchInitiatorTypeNames.h"
@@ -42,6 +43,7 @@
#include "core/fileapi/File.h"
#include "core/frame/FrameConsole.h"
#include "core/frame/LocalFrame.h"
+#include "core/frame/csp/ContentSecurityPolicy.h"
#include "core/html/FormData.h"
#include "core/inspector/ConsoleMessage.h"
#include "core/inspector/InspectorInstrumentation.h"
@@ -473,6 +475,12 @@ void PingLoader::sendLinkAuditPing(LocalFrame* frame,
if (!pingURL.protocolIsInHTTPFamily())
return;
+ if (ContentSecurityPolicy* policy =
+ frame->securityContext()->contentSecurityPolicy()) {
+ if (!policy->allowConnectToSource(pingURL))
+ return;
+ }
+
ResourceRequest request(pingURL);
request.setHTTPMethod(HTTPNames::POST);
request.setHTTPContentType("text/ping");
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/connect-src-anchor-ping-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698