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

Unified Diff: third_party/WebKit/Source/core/frame/DOMWindow.cpp

Issue 2873223003: CSP: Measure the frequency of `postMessage` violating `connect-src` (Closed)
Patch Set: Rebase. Created 3 years, 7 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 | « no previous file | third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/DOMWindow.cpp
diff --git a/third_party/WebKit/Source/core/frame/DOMWindow.cpp b/third_party/WebKit/Source/core/frame/DOMWindow.cpp
index 0eef0681459756f6281eff8d1743511e109bb5ca..494b9c9621af541389e29938ff45d6541bfcfb77 100644
--- a/third_party/WebKit/Source/core/frame/DOMWindow.cpp
+++ b/third_party/WebKit/Source/core/frame/DOMWindow.cpp
@@ -18,6 +18,7 @@
#include "core/frame/Location.h"
#include "core/frame/Settings.h"
#include "core/frame/UseCounter.h"
+#include "core/frame/csp/ContentSecurityPolicy.h"
#include "core/input/InputDeviceCapabilities.h"
#include "core/inspector/ConsoleMessage.h"
#include "core/loader/MixedContentChecker.h"
@@ -235,6 +236,13 @@ void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message,
}
}
+ if (!source_document->GetContentSecurityPolicy()->AllowConnectToSource(
+ target_url, RedirectStatus::kNoRedirect,
+ SecurityViolationReportingPolicy::kSuppressReporting)) {
+ UseCounter::Count(
+ GetFrame(), UseCounter::kPostMessageOutgoingWouldBeBlockedByConnectSrc);
+ }
+
MessageEvent* event =
MessageEvent::Create(std::move(channels), std::move(message),
source_origin, String(), source, source_suborigin);
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698