Title: [184099] releases/WebKitGTK/webkit-2.8
Revision
184099
Author
[email protected]
Date
2015-05-11 08:15:18 -0700 (Mon, 11 May 2015)

Log Message

Merge r183280,r183672 - Origin header is preserved on cross-origin redirects.
https://bugs.webkit.org/show_bug.cgi?id=144157.

Reviewed by Sam Weinig.

Source/WebCore:

Tests: http/tests/security/cors-post-redirect-301.html
       http/tests/security/cors-post-redirect-302.html
       http/tests/security/cors-post-redirect-307.html
       http/tests/security/cors-post-redirect-308.html

* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::ResourceHandle::willSendRequest): Always clear any origin header for cross-origin redirects.
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::willSendRequest): Ditto.

LayoutTests:

* http/tests/security/cors-post-redirect-301-expected.txt: Added.
* http/tests/security/cors-post-redirect-301.html: Added.
* http/tests/security/cors-post-redirect-302-expected.txt: Added.
* http/tests/security/cors-post-redirect-302.html: Added.
* http/tests/security/cors-post-redirect-307-expected.txt: Added.
* http/tests/security/cors-post-redirect-307.html: Added.
* http/tests/security/cors-post-redirect-308-expected.txt: Added.
* http/tests/security/cors-post-redirect-308.html: Added.
* http/tests/security/resources/cors-post-redirect-target.php: Added.

[GTK] New CORS tests from r183280 fail on WebKitGTK+
https://bugs.webkit.org/show_bug.cgi?id=144469

Reviewed by Sergio Villar Senin.

No new tests. This causes failing tests to pass.

* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::doRedirect): Clear the origin header on cross-origin redirects.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog (184098 => 184099)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog	2015-05-11 15:08:28 UTC (rev 184098)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog	2015-05-11 15:15:18 UTC (rev 184099)
@@ -1,3 +1,20 @@
+2015-04-24  Brady Eidson  <[email protected]>
+
+        Origin header is preserved on cross-origin redirects.
+        https://bugs.webkit.org/show_bug.cgi?id=144157.
+
+        Reviewed by Sam Weinig.
+
+        * http/tests/security/cors-post-redirect-301-expected.txt: Added.
+        * http/tests/security/cors-post-redirect-301.html: Added.
+        * http/tests/security/cors-post-redirect-302-expected.txt: Added.
+        * http/tests/security/cors-post-redirect-302.html: Added.
+        * http/tests/security/cors-post-redirect-307-expected.txt: Added.
+        * http/tests/security/cors-post-redirect-307.html: Added.
+        * http/tests/security/cors-post-redirect-308-expected.txt: Added.
+        * http/tests/security/cors-post-redirect-308.html: Added.
+        * http/tests/security/resources/cors-post-redirect-target.php: Added.
+
 2015-04-24  Matthew Mirman  <[email protected]>
 
         Added tests to ensure that Object.prototype.__proto__ native getter and setter do not coerce undefined to this

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-301-expected.txt (0 => 184099)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-301-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-301-expected.txt	2015-05-11 15:15:18 UTC (rev 184099)
@@ -0,0 +1 @@
+There was no origin header

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-301.html (0 => 184099)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-301.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-301.html	2015-05-11 15:15:18 UTC (rev 184099)
@@ -0,0 +1,24 @@
+<head>
+<script>
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+</script>
+</head>
+<body>
+
+This test is designed to work only when loaded from http://127.0.0.1:8000
+
+<form id='testForm' method='POST'>
+<input id='redircode' type='hidden' name='redircode' value='301'>
+</form>
+
+<script>
+
+var form = document.getElementById('testForm');
+form.action = ""
+form.submit();
+ 
+</script>
+</body>

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-302-expected.txt (0 => 184099)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-302-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-302-expected.txt	2015-05-11 15:15:18 UTC (rev 184099)
@@ -0,0 +1 @@
+There was no origin header

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-302.html (0 => 184099)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-302.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-302.html	2015-05-11 15:15:18 UTC (rev 184099)
@@ -0,0 +1,24 @@
+<head>
+<script>
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+</script>
+</head>
+<body>
+
+This test is designed to work only when loaded from http://127.0.0.1:8000
+
+<form id='testForm' method='POST'>
+<input id='redircode' type='hidden' name='redircode' value='302'>
+</form>
+
+<script>
+
+var form = document.getElementById('testForm');
+form.action = ""
+form.submit();
+ 
+</script>
+</body>

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-307-expected.txt (0 => 184099)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-307-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-307-expected.txt	2015-05-11 15:15:18 UTC (rev 184099)
@@ -0,0 +1 @@
+There was no origin header

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-307.html (0 => 184099)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-307.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-307.html	2015-05-11 15:15:18 UTC (rev 184099)
@@ -0,0 +1,24 @@
+<head>
+<script>
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+</script>
+</head>
+<body>
+
+This test is designed to work only when loaded from http://127.0.0.1:8000
+
+<form id='testForm' method='POST'>
+<input id='redircode' type='hidden' name='redircode' value='307'>
+</form>
+
+<script>
+
+var form = document.getElementById('testForm');
+form.action = ""
+form.submit();
+ 
+</script>
+</body>

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-308-expected.txt (0 => 184099)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-308-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-308-expected.txt	2015-05-11 15:15:18 UTC (rev 184099)
@@ -0,0 +1 @@
+There was no origin header

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-308.html (0 => 184099)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-308.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/cors-post-redirect-308.html	2015-05-11 15:15:18 UTC (rev 184099)
@@ -0,0 +1,24 @@
+<head>
+<script>
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+</script>
+</head>
+<body>
+
+This test is designed to work only when loaded from http://127.0.0.1:8000
+
+<form id='testForm' method='POST'>
+<input id='redircode' type='hidden' name='redircode' value='308'>
+</form>
+
+<script>
+
+var form = document.getElementById('testForm');
+form.action = ""
+form.submit();
+ 
+</script>
+</body>

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/resources/cors-post-redirect-target.php (0 => 184099)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/resources/cors-post-redirect-target.php	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/security/resources/cors-post-redirect-target.php	2015-05-11 15:15:18 UTC (rev 184099)
@@ -0,0 +1,17 @@
+<?php
+$sawOrigin = false;
+foreach (getallheaders() as $name => $value) {
+    if (strtolower($name) == "origin") {
+        echo "Origin header value: $value";
+        $sawOrigin = true;
+    }
+}
+
+if (!$sawOrigin)
+    echo "There was no origin header";
+
+?>
+<script>
+if (window.testRunner)
+    testRunner.notifyDone();
+</script>

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (184098 => 184099)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-05-11 15:08:28 UTC (rev 184098)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-05-11 15:15:18 UTC (rev 184099)
@@ -1,3 +1,32 @@
+2015-05-01  Martin Robinson  <[email protected]>
+
+        [GTK] New CORS tests from r183280 fail on WebKitGTK+
+        https://bugs.webkit.org/show_bug.cgi?id=144469
+
+        Reviewed by Sergio Villar Senin.
+
+        No new tests. This causes failing tests to pass.
+
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        (WebCore::doRedirect): Clear the origin header on cross-origin redirects.
+
+2015-04-24  Brady Eidson  <[email protected]>
+
+        Origin header is preserved on cross-origin redirects.
+        https://bugs.webkit.org/show_bug.cgi?id=144157.
+
+        Reviewed by Sam Weinig.
+
+        Tests: http/tests/security/cors-post-redirect-301.html
+               http/tests/security/cors-post-redirect-302.html
+               http/tests/security/cors-post-redirect-307.html
+               http/tests/security/cors-post-redirect-308.html
+
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::ResourceHandle::willSendRequest): Always clear any origin header for cross-origin redirects.
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::willSendRequest): Ditto.
+
 2015-04-24  Carlos Garcia Campos  <[email protected]>
 
         [SOUP] Use a webkit subdirectory for the disk cache

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (184098 => 184099)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2015-05-11 15:08:28 UTC (rev 184098)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2015-05-11 15:15:18 UTC (rev 184099)
@@ -273,9 +273,10 @@
     request.removeCredentials();
 
     if (!protocolHostAndPortAreEqual(request.url(), redirectResponse.url())) {
-        // If the network layer carries over authentication headers from the original request
-        // in a cross-origin redirect, we want to clear those headers here.
+        // The network layer might carry over some headers from the original request that
+        // we want to strip here because the redirect is cross-origin.
         request.clearHTTPAuthorization();
+        request.clearHTTPOrigin();
     } else {
         // Only consider applying authentication credentials if this is actually a redirect and the redirect
         // URL didn't include credentials of its own.

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (184098 => 184099)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2015-05-11 15:08:28 UTC (rev 184098)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2015-05-11 15:15:18 UTC (rev 184099)
@@ -462,10 +462,10 @@
     request.removeCredentials();
 
     if (!protocolHostAndPortAreEqual(request.url(), redirectResponse.url())) {
-        // If the network layer carries over authentication headers from the original request
-        // in a cross-origin redirect, we want to clear those headers here.
-        // As of Lion, CFNetwork no longer does this.
+        // The network layer might carry over some headers from the original request that
+        // we want to strip here because the redirect is cross-origin.
         request.clearHTTPAuthorization();
+        request.clearHTTPOrigin();
     } else {
         // Only consider applying authentication credentials if this is actually a redirect and the redirect
         // URL didn't include credentials of its own.

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (184098 => 184099)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2015-05-11 15:08:28 UTC (rev 184098)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2015-05-11 15:15:18 UTC (rev 184099)
@@ -517,6 +517,7 @@
         // If the network layer carries over authentication headers from the original request
         // in a cross-origin redirect, we want to clear those headers here. 
         newRequest.clearHTTPAuthorization();
+        newRequest.clearHTTPOrigin();
 
         // TODO: We are losing any username and password specified in the redirect URL, as this is the 
         // same behavior as the CFNet port. We should investigate if this is really what we want.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to