-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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. Canonical link: https://commits.webkit.org/162147@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183280 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
13 changed files
with
157 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
LayoutTests/http/tests/security/cors-post-redirect-301-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
There was no origin header |
24 changes: 24 additions & 0 deletions
24
LayoutTests/http/tests/security/cors-post-redirect-301.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = "/resources/redirect.php?code=301&url=http://localhost:8000/security/resources/cors-post-redirect-target.php"; | ||
form.submit(); | ||
|
||
</script> | ||
</body> |
1 change: 1 addition & 0 deletions
1
LayoutTests/http/tests/security/cors-post-redirect-302-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
There was no origin header |
24 changes: 24 additions & 0 deletions
24
LayoutTests/http/tests/security/cors-post-redirect-302.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = "/resources/redirect.php?code=302&url=http://localhost:8000/security/resources/cors-post-redirect-target.php"; | ||
form.submit(); | ||
|
||
</script> | ||
</body> |
1 change: 1 addition & 0 deletions
1
LayoutTests/http/tests/security/cors-post-redirect-307-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
There was no origin header |
24 changes: 24 additions & 0 deletions
24
LayoutTests/http/tests/security/cors-post-redirect-307.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = "/resources/redirect.php?code=307&url=http://localhost:8000/security/resources/cors-post-redirect-target.php"; | ||
form.submit(); | ||
|
||
</script> | ||
</body> |
1 change: 1 addition & 0 deletions
1
LayoutTests/http/tests/security/cors-post-redirect-308-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
There was no origin header |
24 changes: 24 additions & 0 deletions
24
LayoutTests/http/tests/security/cors-post-redirect-308.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = "/resources/redirect.php?code=308&url=http://localhost:8000/security/resources/cors-post-redirect-target.php"; | ||
form.submit(); | ||
|
||
</script> | ||
</body> |
17 changes: 17 additions & 0 deletions
17
LayoutTests/http/tests/security/resources/cors-post-redirect-target.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters