Title: [201468] trunk
- Revision
- 201468
- Author
- [email protected]
- Date
- 2016-05-27 13:50:04 -0700 (Fri, 27 May 2016)
Log Message
CSP: Fire 'load' events even when blocking loads via 'frame-src'.
https://bugs.webkit.org/show_bug.cgi?id=153150
<rdar://problem/24383162>
Reviewed by Daniel Bates.
Source/WebCore:
Always fire a load event, even when the load is blocked by CSP rules, so that
attackers cannot gain knowledge about the URL in the frame by blocking the
load and waiting long enough to be sure that a 'load' event would have
fired if the load wasn't blocked.
Inspired by Blink patch:
<https://src.chromium.org/viewvc/blink?view=rev&revision=165743>
Tests: http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load.html
* loader/PolicyChecker.cpp:
(WebCore::PolicyChecker::checkNavigationPolicy):
LayoutTests:
* TestExpectations: Unskip the cross-origin load test.
* http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load-expected.txt: Update to match
our message format.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (201467 => 201468)
--- trunk/LayoutTests/ChangeLog 2016-05-27 20:45:08 UTC (rev 201467)
+++ trunk/LayoutTests/ChangeLog 2016-05-27 20:50:04 UTC (rev 201468)
@@ -1,3 +1,15 @@
+2016-05-27 Brent Fulgham <[email protected]>
+
+ CSP: Fire 'load' events even when blocking loads via 'frame-src'.
+ https://bugs.webkit.org/show_bug.cgi?id=153150
+ <rdar://problem/24383162>
+
+ Reviewed by Daniel Bates.
+
+ * TestExpectations: Unskip the cross-origin load test.
+ * http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load-expected.txt: Update to match
+ our message format.
+
2016-05-27 Saam barati <[email protected]>
ShadowChicken/DebuggerCallFrame don't properly handle when the entry stack frame is a tail deleted frame
Modified: trunk/LayoutTests/TestExpectations (201467 => 201468)
--- trunk/LayoutTests/TestExpectations 2016-05-27 20:45:08 UTC (rev 201467)
+++ trunk/LayoutTests/TestExpectations 2016-05-27 20:50:04 UTC (rev 201468)
@@ -842,7 +842,6 @@
webkit.org/b/153148 http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.php
webkit.org/b/153150 http/tests/security/contentSecurityPolicy/1.1/child-src/frame-fires-load-event-when-blocked.html
webkit.org/b/153150 http/tests/security/contentSecurityPolicy/1.1/child-src/frame-fires-load-event-when-redirect-blocked.html
-webkit.org/b/153150 http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load.html
webkit.org/b/153152 http/tests/security/contentSecurityPolicy/manifest-src-allowed.html # Needs testRunner.getManifestThen()
webkit.org/b/153152 http/tests/security/contentSecurityPolicy/manifest-src-blocked.html # Needs testRunner.getManifestThen()
webkit.org/b/153155 http/tests/security/contentSecurityPolicy/1.1/scripthash-basic-blocked-error-event.html
Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load-expected.txt (201467 => 201468)
--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load-expected.txt 2016-05-27 20:45:08 UTC (rev 201467)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load-expected.txt 2016-05-27 20:50:04 UTC (rev 201468)
@@ -1,5 +1,4 @@
-CONSOLE MESSAGE: line 24: Refused to frame 'https://localhost:8443/security/contentSecurityPolicy/resources/alert-fail.html' because it violates the following Content Security Policy directive: "frame-src 'self' http://localhost:8080".
-
+CONSOLE MESSAGE: Refused to load https://localhost:8443/security/contentSecurityPolicy/resources/alert-fail.html because it does not appear in the frame-src directive of the Content Security Policy.
ALERT: PASS
ALERT: PASS
IFrames blocked by CSP should generate a 'load' event, regardless of blocked state. This means they appear to be normal cross-origin loads, thereby not leaking URL information directly to JS.
Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load.html (201467 => 201468)
--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load.html 2016-05-27 20:45:08 UTC (rev 201467)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load.html 2016-05-27 20:50:04 UTC (rev 201468)
@@ -1,11 +1,11 @@
<!DOCTYPE html>
<html>
<head>
- <script src=""
+ <script src=""
<meta http-equiv="Content-Security-Policy" content="frame-src 'self' http://localhost:8080">
<script>
- window.jsTestIsAsync = true;
- window.wasPostTestScriptParsed = true;
+ if (window.testRunner)
+ testRunner.waitUntilDone();
description("IFrames blocked by CSP should generate a 'load' event, regardless of blocked state. This means they appear to be normal cross-origin loads, thereby not leaking URL information directly to JS.");
@@ -13,8 +13,10 @@
function loadEvent() {
loads++;
testPassed("IFrame #" + loads + " generated a 'load' event.");
- if (loads == 3)
- finishJSTest();
+ if (loads == 3) {
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
}
</script>
</head>
@@ -22,5 +24,6 @@
<iframe src="" _onload_="loadEvent()"></iframe>
<iframe src="" _onload_="loadEvent()"></iframe>
<iframe src="" _onload_="loadEvent()"></iframe>
+ <script src=""
</body>
</html>
Modified: trunk/Source/WebCore/ChangeLog (201467 => 201468)
--- trunk/Source/WebCore/ChangeLog 2016-05-27 20:45:08 UTC (rev 201467)
+++ trunk/Source/WebCore/ChangeLog 2016-05-27 20:50:04 UTC (rev 201468)
@@ -1,3 +1,24 @@
+2016-05-27 Brent Fulgham <[email protected]>
+
+ CSP: Fire 'load' events even when blocking loads via 'frame-src'.
+ https://bugs.webkit.org/show_bug.cgi?id=153150
+ <rdar://problem/24383162>
+
+ Reviewed by Daniel Bates.
+
+ Always fire a load event, even when the load is blocked by CSP rules, so that
+ attackers cannot gain knowledge about the URL in the frame by blocking the
+ load and waiting long enough to be sure that a 'load' event would have
+ fired if the load wasn't blocked.
+
+ Inspired by Blink patch:
+ <https://src.chromium.org/viewvc/blink?view=rev&revision=165743>
+
+ Tests: http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load.html
+
+ * loader/PolicyChecker.cpp:
+ (WebCore::PolicyChecker::checkNavigationPolicy):
+
2016-05-27 Andreas Kling <[email protected]>
Document abandons its EventTargetData.
Modified: trunk/Source/WebCore/loader/PolicyChecker.cpp (201467 => 201468)
--- trunk/Source/WebCore/loader/PolicyChecker.cpp 2016-05-27 20:45:08 UTC (rev 201467)
+++ trunk/Source/WebCore/loader/PolicyChecker.cpp 2016-05-27 20:50:04 UTC (rev 201468)
@@ -98,6 +98,11 @@
}
if (!isAllowedByContentSecurityPolicy(request.url(), m_frame.ownerElement(), didReceiveRedirectResponse)) {
+ if (m_frame.ownerElement()) {
+ // Fire a load event (even though we were blocked by CSP) as timing attacks would otherwise
+ // reveal that the frame was blocked. This way, it looks like any other cross-origin page load.
+ m_frame.ownerElement()->dispatchEvent(Event::create(eventNames().loadEvent, false, false));
+ }
function(request, 0, false);
return;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes