<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[168273] releases/WebKitGTK/webkit-2.4</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/168273">168273</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-05-05 03:27:19 -0700 (Mon, 05 May 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/166600">r166600</a> - Do not allow HTTP refresh headers to refresh to javascript: URLs
<http://webkit.org/b/119051>
<rdar://problem/14536453>
Reviewed by Alexey Proskuryakov.
Merged from Blink (patch by tsepez@chromium.org):
https://src.chromium.org/viewvc/blink?revision=153912&view=revision
http://crbug.com/258151
This behaviour has been standard in IE since IE7. This makes us both
more compatible and less vulnerable to XSS.
Source/WebCore:
Tests: http/tests/security/no-javascript-location-percent-escaped.html
http/tests/security/no-javascript-location.html
http/tests/security/no-javascript-refresh-percent-escaped.php
http/tests/security/no-javascript-refresh-spaces.php
http/tests/security/no-javascript-refresh-static-percent-escaped.html
http/tests/security/no-javascript-refresh-static-spaces.html
http/tests/security/no-javascript-refresh-static.html
http/tests/security/no-javascript-refresh.php
* dom/Document.cpp:
(WebCore::Document::processHttpEquiv):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::receivedFirstData):
- Do not fire meta http refresh for a javascript: URL protocol.
LayoutTests:
* http/tests/security/no-javascript-refresh-expected.txt: Added.
* http/tests/security/no-javascript-refresh-static-expected.txt: Added.
* http/tests/security/no-javascript-refresh-static.html: Added.
* http/tests/security/no-javascript-refresh.php: Added.
- Original Blink layout tests with typos fixed and 'PASS:' text
added.
* http/tests/security/no-javascript-location.html: Added.
* http/tests/security/no-javascript-location-expected.txt: Added.
* http/tests/security/resources/no-javascript-location.php: Copied from LayoutTests/http/tests/security/no-javascript-refresh.php.
* http/tests/security/no-javascript-location-percent-escaped.html: Added.
* http/tests/security/no-javascript-location-percent-escaped-expected.txt: Added.
* http/tests/security/resources/no-javascript-location-percent-escaped.php: Added.
- Add tests using a javascript: URL in a Location: header.
* http/tests/security/no-javascript-refresh-percent-escaped.php: Copied from LayoutTests/http/tests/security/no-javascript-refresh.php.
* http/tests/security/no-javascript-refresh-percent-escaped-expected.txt: Added.
* http/tests/security/no-javascript-refresh-spaces.php: Copied from LayoutTests/http/tests/security/no-javascript-refresh.php.
* http/tests/security/no-javascript-refresh-spaces-expected.txt: Added.
- Add tests using a percent-escaped javascript: URL and a
javascript: URL with leading spaces in a Refresh: header from
a web server.
* http/tests/security/no-javascript-refresh-static-percent-escaped.html: Added.
* http/tests/security/no-javascript-refresh-static-percent-escaped-expected.txt: Added.
* http/tests/security/no-javascript-refresh-static-spaces.html: Added.
* http/tests/security/no-javascript-refresh-static-spaces-expected.txt: Added.
- Add tests using a percent-escaped javascript: URL and a
javascript: URL with leading spaces in a meta http-equiv tag.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestsChangeLog">releases/WebKitGTK/webkit-2.4/LayoutTests/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoredomDocumentcpp">releases/WebKitGTK/webkit-2.4/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreloaderFrameLoadercpp">releases/WebKitGTK/webkit-2.4/Source/WebCore/loader/FrameLoader.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptlocationexpectedtxt">releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-location-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptlocationpercentescapedexpectedtxt">releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-location-percent-escaped-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptlocationpercentescapedhtml">releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-location-percent-escaped.html</a></li>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptlocationhtml">releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-location.html</a></li>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshexpectedtxt">releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshpercentescapedexpectedtxt">releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-percent-escaped-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshpercentescapedphp">releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-percent-escaped.php</a></li>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshspacesexpectedtxt">releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-spaces-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshspacesphp">releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-spaces.php</a></li>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshstaticexpectedtxt">releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshstaticpercentescapedexpectedtxt">releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-percent-escaped-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshstaticpercentescapedhtml">releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-percent-escaped.html</a></li>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshstaticspacesexpectedtxt">releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-spaces-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshstaticspaceshtml">releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-spaces.html</a></li>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshstatichtml">releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static.html</a></li>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshphp">releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh.php</a></li>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestshttptestssecurityresourcesnojavascriptlocationpercentescapedphp">releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/resources/no-javascript-location-percent-escaped.php</a></li>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestshttptestssecurityresourcesnojavascriptlocationphp">releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/resources/no-javascript-location.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit24LayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/LayoutTests/ChangeLog (168272 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/ChangeLog        2014-05-05 10:09:29 UTC (rev 168272)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/ChangeLog        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -1,3 +1,48 @@
</span><ins>+2014-04-01 David Kilzer <ddkilzer@apple.com>
+
+ Do not allow HTTP refresh headers to refresh to javascript: URLs
+ <http://webkit.org/b/119051>
+ <rdar://problem/14536453>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Merged from Blink (patch by tsepez@chromium.org):
+ https://src.chromium.org/viewvc/blink?revision=153912&view=revision
+ http://crbug.com/258151
+
+ This behaviour has been standard in IE since IE7. This makes us both
+ more compatible and less vulnerable to XSS.
+
+ * http/tests/security/no-javascript-refresh-expected.txt: Added.
+ * http/tests/security/no-javascript-refresh-static-expected.txt: Added.
+ * http/tests/security/no-javascript-refresh-static.html: Added.
+ * http/tests/security/no-javascript-refresh.php: Added.
+ - Original Blink layout tests with typos fixed and 'PASS:' text
+ added.
+
+ * http/tests/security/no-javascript-location.html: Added.
+ * http/tests/security/no-javascript-location-expected.txt: Added.
+ * http/tests/security/resources/no-javascript-location.php: Copied from LayoutTests/http/tests/security/no-javascript-refresh.php.
+ * http/tests/security/no-javascript-location-percent-escaped.html: Added.
+ * http/tests/security/no-javascript-location-percent-escaped-expected.txt: Added.
+ * http/tests/security/resources/no-javascript-location-percent-escaped.php: Added.
+ - Add tests using a javascript: URL in a Location: header.
+
+ * http/tests/security/no-javascript-refresh-percent-escaped.php: Copied from LayoutTests/http/tests/security/no-javascript-refresh.php.
+ * http/tests/security/no-javascript-refresh-percent-escaped-expected.txt: Added.
+ * http/tests/security/no-javascript-refresh-spaces.php: Copied from LayoutTests/http/tests/security/no-javascript-refresh.php.
+ * http/tests/security/no-javascript-refresh-spaces-expected.txt: Added.
+ - Add tests using a percent-escaped javascript: URL and a
+ javascript: URL with leading spaces in a Refresh: header from
+ a web server.
+
+ * http/tests/security/no-javascript-refresh-static-percent-escaped.html: Added.
+ * http/tests/security/no-javascript-refresh-static-percent-escaped-expected.txt: Added.
+ * http/tests/security/no-javascript-refresh-static-spaces.html: Added.
+ * http/tests/security/no-javascript-refresh-static-spaces-expected.txt: Added.
+ - Add tests using a percent-escaped javascript: URL and a
+ javascript: URL with leading spaces in a meta http-equiv tag.
+
</ins><span class="cx"> 2014-03-29 David Kilzer <ddkilzer@apple.com>
</span><span class="cx">
</span><span class="cx"> Preserve selection end positions in directionOfSelection
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptlocationexpectedtxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-location-expected.txt (0 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-location-expected.txt         (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-location-expected.txt        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+PASS: This is the content that appears in place of a Location redirect to a javascript: URL.
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptlocationpercentescapedexpectedtxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-location-percent-escaped-expected.txt (0 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-location-percent-escaped-expected.txt         (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-location-percent-escaped-expected.txt        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+PASS: This is the content that appears in place of a Location redirect to a javascript: URL.
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptlocationpercentescapedhtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-location-percent-escaped.html (0 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-location-percent-escaped.html         (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-location-percent-escaped.html        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+<!DOCTYPE html>
+<head>
+<meta http-equiv='refresh' content='0;URL=resources/no-javascript-location-percent-escaped.php'/>
+</head>
+<body>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+PASS: This is the content that appears in place of a Location redirect to a javascript: URL.
+</body>
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptlocationhtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-location.html (0 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-location.html         (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-location.html        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+<!DOCTYPE html>
+<head>
+<meta http-equiv='refresh' content='0;URL=resources/no-javascript-location.php'/>
+</head>
+<body>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+PASS: This is the content that appears in place of a Location redirect to a javascript: URL.
+</body>
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshexpectedtxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-expected.txt (0 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-expected.txt         (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-expected.txt        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+CONSOLE MESSAGE: line 1: Refused to refresh http://127.0.0.1:8000/security/no-javascript-refresh.php to a javascript: URL
+PASS: This is the content that appears in place of a refresh.
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshpercentescapedexpectedtxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-percent-escaped-expected.txt (0 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-percent-escaped-expected.txt         (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-percent-escaped-expected.txt        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+PASS: This is the content that appears in place of a failed refresh.
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshpercentescapedphp"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-percent-escaped.php (0 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-percent-escaped.php         (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-percent-escaped.php        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+<?php
+ header('HTTP/1.0 200 OK');
+ header('Content-type: text/html');
+ header('Refresh: 0;URL=%6A%61%76%61%73%63%72%69%70%74:window.top.location="about:blank"');
+?>
+<!DOCTYPE html>
+<body>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+PASS: This is the content that appears in place of a failed refresh.
+</body>
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshspacesexpectedtxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-spaces-expected.txt (0 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-spaces-expected.txt         (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-spaces-expected.txt        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+CONSOLE MESSAGE: line 1: Refused to refresh http://127.0.0.1:8000/security/no-javascript-refresh-spaces.php to a javascript: URL
+PASS: This is the content that appears in place of a refresh.
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshspacesphp"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-spaces.php (0 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-spaces.php         (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-spaces.php        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+<?php
+ header('HTTP/1.0 200 OK');
+ header('Content-type: text/html');
+ header('Refresh: 0;URL= javascript:window.top.location="about:blank"');
+?>
+<!DOCTYPE html>
+<body>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+PASS: This is the content that appears in place of a refresh.
+</body>
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshstaticexpectedtxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-expected.txt (0 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-expected.txt         (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-expected.txt        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+CONSOLE MESSAGE: line 3: Refused to refresh http://127.0.0.1:8000/security/no-javascript-refresh-static.html to a javascript: URL
+PASS: This is the text that appears in place of a refresh.
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshstaticpercentescapedexpectedtxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-percent-escaped-expected.txt (0 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-percent-escaped-expected.txt         (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-percent-escaped-expected.txt        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+PASS: This is the text that appears in place of a failed refresh.
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshstaticpercentescapedhtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-percent-escaped.html (0 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-percent-escaped.html         (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-percent-escaped.html        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+<!DOCTYPE html>
+<head>
+<meta http-equiv='refresh' content='0;URL=%6A%61%76%61%73%63%72%69%70%74:window.top.location="about:blank"'/>
+</head>
+<body>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+PASS: This is the text that appears in place of a failed refresh.
+</body>
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshstaticspacesexpectedtxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-spaces-expected.txt (0 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-spaces-expected.txt         (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-spaces-expected.txt        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+CONSOLE MESSAGE: line 3: Refused to refresh http://127.0.0.1:8000/security/no-javascript-refresh-static-spaces.html to a javascript: URL
+PASS: This is the text that appears in place of a refresh.
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshstaticspaceshtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-spaces.html (0 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-spaces.html         (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static-spaces.html        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+<!DOCTYPE html>
+<head>
+<meta http-equiv='refresh' content='0;URL= javascript:window.top.location="about:blank"'/>
+</head>
+<body>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+PASS: This is the text that appears in place of a refresh.
+</body>
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshstatichtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static.html (0 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static.html         (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh-static.html        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+<!DOCTYPE html>
+<head>
+<meta http-equiv='refresh' content='0;URL=javascript:window.top.location="about:blank"'/>
+</head>
+<body>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+PASS: This is the text that appears in place of a refresh.
+</body>
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestshttptestssecuritynojavascriptrefreshphp"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh.php (0 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh.php         (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/no-javascript-refresh.php        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+<?php
+ header('HTTP/1.0 200 OK');
+ header('Content-type: text/html');
+ header('Refresh: 0;URL=javascript:window.top.location="about:blank"');
+?>
+<!DOCTYPE html>
+<body>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+PASS: This is the content that appears in place of a refresh.
+</body>
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestshttptestssecurityresourcesnojavascriptlocationpercentescapedphp"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/resources/no-javascript-location-percent-escaped.php (0 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/resources/no-javascript-location-percent-escaped.php         (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/resources/no-javascript-location-percent-escaped.php        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+<?php
+ header('HTTP/1.0 200 OK');
+ header('Content-type: text/html');
+ header('Location: %6A%61%76%61%73%63%72%69%70%74:window.top.location="about:blank"');
+?>
+<!DOCTYPE html>
+<body>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+FAIL: This content should not appear after a failed Location redirect to a javascript: URL.
+</body>
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestshttptestssecurityresourcesnojavascriptlocationphp"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/resources/no-javascript-location.php (0 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/resources/no-javascript-location.php         (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/resources/no-javascript-location.php        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+<?php
+ header('HTTP/1.0 200 OK');
+ header('Content-type: text/html');
+ header('Location: javascript:window.top.location="about:blank"');
+?>
+<!DOCTYPE html>
+<body>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+FAIL: This content should not appear after a failed Location redirect to a javascript: URL.
+</body>
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog (168272 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog        2014-05-05 10:09:29 UTC (rev 168272)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2014-04-01 David Kilzer <ddkilzer@apple.com>
+
+ Do not allow HTTP refresh headers to refresh to javascript: URLs
+ <http://webkit.org/b/119051>
+ <rdar://problem/14536453>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Merged from Blink (patch by tsepez@chromium.org):
+ https://src.chromium.org/viewvc/blink?revision=153912&view=revision
+ http://crbug.com/258151
+
+ This behaviour has been standard in IE since IE7. This makes us both
+ more compatible and less vulnerable to XSS.
+
+ Tests: http/tests/security/no-javascript-location-percent-escaped.html
+ http/tests/security/no-javascript-location.html
+ http/tests/security/no-javascript-refresh-percent-escaped.php
+ http/tests/security/no-javascript-refresh-spaces.php
+ http/tests/security/no-javascript-refresh-static-percent-escaped.html
+ http/tests/security/no-javascript-refresh-static-spaces.html
+ http/tests/security/no-javascript-refresh-static.html
+ http/tests/security/no-javascript-refresh.php
+
+ * dom/Document.cpp:
+ (WebCore::Document::processHttpEquiv):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::receivedFirstData):
+ - Do not fire meta http refresh for a javascript: URL protocol.
+
</ins><span class="cx"> 2014-03-29 David Kilzer <ddkilzer@apple.com>
</span><span class="cx">
</span><span class="cx"> Preserve selection end positions in directionOfSelection
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/dom/Document.cpp (168272 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/dom/Document.cpp        2014-05-05 10:09:29 UTC (rev 168272)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/dom/Document.cpp        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -2841,7 +2841,12 @@
</span><span class="cx"> url = m_url.string();
</span><span class="cx"> else
</span><span class="cx"> url = completeURL(url).string();
</span><del>- frame->navigationScheduler().scheduleRedirect(delay, url);
</del><ins>+ if (!protocolIsJavaScript(url))
+ frame->navigationScheduler().scheduleRedirect(delay, url);
+ else {
+ String message = "Refused to refresh " + m_url.stringCenterEllipsizedToLength() + " to a javascript: URL";
+ addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message);
+ }
</ins><span class="cx"> }
</span><span class="cx"> } else if (equalIgnoringCase(equiv, "set-cookie")) {
</span><span class="cx"> // FIXME: make setCookie work on XML documents too; e.g. in case of <html:meta .....>
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/loader/FrameLoader.cpp (168272 => 168273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/loader/FrameLoader.cpp        2014-05-05 10:09:29 UTC (rev 168272)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/loader/FrameLoader.cpp        2014-05-05 10:27:19 UTC (rev 168273)
</span><span class="lines">@@ -681,7 +681,12 @@
</span><span class="cx"> else
</span><span class="cx"> url = m_frame.document()->completeURL(url).string();
</span><span class="cx">
</span><del>- m_frame.navigationScheduler().scheduleRedirect(delay, url);
</del><ins>+ if (!protocolIsJavaScript(url))
+ m_frame.navigationScheduler().scheduleRedirect(delay, url);
+ else {
+ String message = "Refused to refresh " + m_frame.document()->url().stringCenterEllipsizedToLength() + " to a javascript: URL";
+ m_frame.document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void FrameLoader::setOutgoingReferrer(const URL& url)
</span></span></pre>
</div>
</div>
</body>
</html>