<!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>[175074] trunk</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/175074">175074</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2014-10-22 16:43:11 -0700 (Wed, 22 Oct 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>SVG loaded through html <img> can't request to load any external resources.
https://bugs.webkit.org/show_bug.cgi?id=137762.
Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2014-10-22
Reviewed by Daniel Bates.
Source/WebCore:
SVG images have unique security rules that prevent them from loading any external
resources. This patch enforces these rules in CachedResourceLoader::canRequest for
all non-data-uri resources.
The fix and the tests are ported but modified a little from the chromium fix:
http://src.chromium.org/viewvc/blink?view=rev&rev=176084
Test: http/tests/security/svg-image-with-cached-remote-image.html
http/tests/security/svg-image-with-css-cross-domain.html
For the SVG image, prevent loading any external sub-resource except for data urls.
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::canRequest):
LayoutTests:
Ensure that SVG images, which are loaded through the <img> tag or through the
CSS background image, cannot load any external sub-resource except for data-
URL resources (though this doesn't work at the time of writing, see bug #137941).
Also ensure the same rule is enforced on cached resources.
The tests are ported but modified a little from the chromium fix:
http://src.chromium.org/viewvc/blink?view=rev&rev=176084
Set the circle background to orange
* http/tests/security/resources/image-with-css-cross-domain-circle.css: Added.
(circle):
Set the circle stroke-width = 2 and the circle stroke = red
* http/tests/security/resources/image-with-css-cross-domain-circle2.css: Added.
(circle):
This svg references the two css files: one is relative path and the other is absolute path
* http/tests/security/resources/image-with-css-cross-domain.svg: Added.
This svg references an external image.
* http/tests/security/resources/image-with-remote-image.svg: Added.
A helper css which sets the formatting style for some html tags
* http/tests/security/svg-image-with-css-cross-domain.css: Added.
(span):
(span.circle-css-cross-domain):
(embed):
(iframe):
Test the svg which is referenced as a cached image by an <object> tag, does not load
external sub-resource.
* http/tests/security/svg-image-with-cached-remote-image-expected.html: Added.
* http/tests/security/svg-image-with-cached-remote-image.html: Added.
Test loading sub-resources for an svg which is included in the html by different ways
and which references external css files.
Ensure the image object does not load any external sub-resources.
* http/tests/security/svg-image-with-css-cross-domain-expected.html: Added.
* http/tests/security/svg-image-with-css-cross-domain.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceLoadercpp">trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestssecurityresourcesimagewithcsscrossdomaincirclecss">trunk/LayoutTests/http/tests/security/resources/image-with-css-cross-domain-circle.css</a></li>
<li><a href="#trunkLayoutTestshttptestssecurityresourcesimagewithcsscrossdomaincircle2css">trunk/LayoutTests/http/tests/security/resources/image-with-css-cross-domain-circle2.css</a></li>
<li><a href="#trunkLayoutTestshttptestssecurityresourcesimagewithcsscrossdomainsvg">trunk/LayoutTests/http/tests/security/resources/image-with-css-cross-domain.svg</a></li>
<li><a href="#trunkLayoutTestshttptestssecurityresourcesimagewithremoteimagesvg">trunk/LayoutTests/http/tests/security/resources/image-with-remote-image.svg</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritysvgimagewithcachedremoteimageexpectedhtml">trunk/LayoutTests/http/tests/security/svg-image-with-cached-remote-image-expected.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritysvgimagewithcachedremoteimagehtml">trunk/LayoutTests/http/tests/security/svg-image-with-cached-remote-image.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritysvgimagewithcsscrossdomainexpectedhtml">trunk/LayoutTests/http/tests/security/svg-image-with-css-cross-domain-expected.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritysvgimagewithcsscrossdomaincss">trunk/LayoutTests/http/tests/security/svg-image-with-css-cross-domain.css</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritysvgimagewithcsscrossdomainhtml">trunk/LayoutTests/http/tests/security/svg-image-with-css-cross-domain.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (175073 => 175074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-10-22 23:27:27 UTC (rev 175073)
+++ trunk/LayoutTests/ChangeLog        2014-10-22 23:43:11 UTC (rev 175074)
</span><span class="lines">@@ -1,3 +1,50 @@
</span><ins>+2014-10-22 Said Abou-Hallawa <sabouhallawa@apple.com>
+
+ SVG loaded through html <img> can't request to load any external resources.
+ https://bugs.webkit.org/show_bug.cgi?id=137762.
+
+ Reviewed by Daniel Bates.
+
+ Ensure that SVG images, which are loaded through the <img> tag or through the
+ CSS background image, cannot load any external sub-resource except for data-
+ URL resources (though this doesn't work at the time of writing, see bug #137941).
+ Also ensure the same rule is enforced on cached resources.
+
+ The tests are ported but modified a little from the chromium fix:
+ http://src.chromium.org/viewvc/blink?view=rev&rev=176084
+
+ Set the circle background to orange
+ * http/tests/security/resources/image-with-css-cross-domain-circle.css: Added.
+ (circle):
+
+ Set the circle stroke-width = 2 and the circle stroke = red
+ * http/tests/security/resources/image-with-css-cross-domain-circle2.css: Added.
+ (circle):
+
+ This svg references the two css files: one is relative path and the other is absolute path
+ * http/tests/security/resources/image-with-css-cross-domain.svg: Added.
+
+ This svg references an external image.
+ * http/tests/security/resources/image-with-remote-image.svg: Added.
+
+ A helper css which sets the formatting style for some html tags
+ * http/tests/security/svg-image-with-css-cross-domain.css: Added.
+ (span):
+ (span.circle-css-cross-domain):
+ (embed):
+ (iframe):
+
+ Test the svg which is referenced as a cached image by an <object> tag, does not load
+ external sub-resource.
+ * http/tests/security/svg-image-with-cached-remote-image-expected.html: Added.
+ * http/tests/security/svg-image-with-cached-remote-image.html: Added.
+
+ Test loading sub-resources for an svg which is included in the html by different ways
+ and which references external css files.
+ Ensure the image object does not load any external sub-resources.
+ * http/tests/security/svg-image-with-css-cross-domain-expected.html: Added.
+ * http/tests/security/svg-image-with-css-cross-domain.html: Added.
+
</ins><span class="cx"> 2014-10-21 Ada Chan <adachan@apple.com>
</span><span class="cx">
</span><span class="cx"> MediaPlayerPrivateAVFoundation::hasAudio() returns false even when there is an audible AVMediaSelectionOption selected
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecurityresourcesimagewithcsscrossdomaincirclecss"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/resources/image-with-css-cross-domain-circle.css (0 => 175074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/resources/image-with-css-cross-domain-circle.css         (rev 0)
+++ trunk/LayoutTests/http/tests/security/resources/image-with-css-cross-domain-circle.css        2014-10-22 23:43:11 UTC (rev 175074)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+circle {
+ fill: orange;
+}
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecurityresourcesimagewithcsscrossdomaincircle2css"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/resources/image-with-css-cross-domain-circle2.css (0 => 175074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/resources/image-with-css-cross-domain-circle2.css         (rev 0)
+++ trunk/LayoutTests/http/tests/security/resources/image-with-css-cross-domain-circle2.css        2014-10-22 23:43:11 UTC (rev 175074)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+circle {
+ stroke: red;
+ stroke-width: 2;
+}
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecurityresourcesimagewithcsscrossdomainsvg"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/resources/image-with-css-cross-domain.svg (0 => 175074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/resources/image-with-css-cross-domain.svg         (rev 0)
+++ trunk/LayoutTests/http/tests/security/resources/image-with-css-cross-domain.svg        2014-10-22 23:43:11 UTC (rev 175074)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?xml-stylesheet type="text/css" href="image-with-css-cross-domain-circle.css"?>
+<?xml-stylesheet type="text/css" href="http://localhost:8000/security/resources/image-with-css-cross-domain-circle2.css"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="68" height="68" viewBox="-34 -34 68 68" >
+ <circle cx="0" cy="0" r="24" fill="#c8c8c8"/>
+</svg>
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecurityresourcesimagewithremoteimagesvg"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/resources/image-with-remote-image.svg (0 => 175074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/resources/image-with-remote-image.svg         (rev 0)
+++ trunk/LayoutTests/http/tests/security/resources/image-with-remote-image.svg        2014-10-22 23:43:11 UTC (rev 175074)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100">
+ <rect width="100%" height="100%" fill="#0f0"/>
+ <rect x="20%" y="20%" width="60%" height="60%" stroke-width="1" stroke="black" fill="transparent"/>
+ <image xlink:href="http://localhost:8000/security/resources/abe.png" x="20%" y="20%" width="60%" height="60%" onload="window.parent.notifyDidLoadSVG()"/>
+</svg>
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritysvgimagewithcachedremoteimageexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/svg-image-with-cached-remote-image-expected.html (0 => 175074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/svg-image-with-cached-remote-image-expected.html         (rev 0)
+++ trunk/LayoutTests/http/tests/security/svg-image-with-cached-remote-image-expected.html        2014-10-22 23:43:11 UTC (rev 175074)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+<!DOCTYPE HTML>
+<html>
+<body>
+<p>SVG loaded in &lt;img&gt; (should not see head of Abe Lincoln)</p>
+<svg width="100" height="100">
+ <rect width="100%" height="100%" fill="#0f0"/>
+ <rect x="20%" y="20%" width="60%" height="60%" stroke-width="1" stroke="black" fill="transparent"/>
+</svg>
+<br>
+<p>SVG loaded in &lt;object&gt; (should see head of Abe Lincoln)</p>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100">
+ <rect width="100%" height="100%" fill="#0f0"/>
+ <rect x="20%" y="20%" width="60%" height="60%" stroke-width="1" stroke="black" fill="transparent"/>
+ <image xlink:href="resources/abe.png" x="20%" y="20%" width="60%" height="60%"/>
+</svg>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritysvgimagewithcachedremoteimagehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/svg-image-with-cached-remote-image.html (0 => 175074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/svg-image-with-cached-remote-image.html         (rev 0)
+++ trunk/LayoutTests/http/tests/security/svg-image-with-cached-remote-image.html        2014-10-22 23:43:11 UTC (rev 175074)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+<!DOCTYPE HTML>
+<html>
+<head>
+<script>
+ if (window.testRunner)
+ testRunner.waitUntilDone();
+
+ // Called from resources/image-with-remote-image.svg when loaded inside <object>.
+ function notifyDidLoadSVG()
+ {
+ function done()
+ {
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+ var image = document.getElementById("non-interactive-SVG");
+ image.onload = done;
+ image.src = "resources/image-with-remote-image.svg";
+ }
+</script>
+</head>
+<body>
+ <p>SVG loaded in &lt;img&gt; (should not see head of Abe Lincoln)</p>
+ <img id="non-interactive-SVG" src="" width="100" height="100">
+ <br>
+ <p>SVG loaded in &lt;object&gt; (should see head of Abe Lincoln)</p>
+ <object id="interactive-SVG" data="resources/image-with-remote-image.svg" width="100" height="100"></object>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritysvgimagewithcsscrossdomainexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/svg-image-with-css-cross-domain-expected.html (0 => 175074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/svg-image-with-css-cross-domain-expected.html         (rev 0)
+++ trunk/LayoutTests/http/tests/security/svg-image-with-css-cross-domain-expected.html        2014-10-22 23:43:11 UTC (rev 175074)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+<!DOCTYPE html>
+<html>
+ <head>
+ <link rel="stylesheet" type="text/css" href="svg-image-with-css-cross-domain.css"/>
+ </head>
+ <body>
+ <h1>WebKit bug</h1>
+ <h3>SVG circle with same-origin and different-origin CSS</h3>
+ <p>Expected: 2 gray circles, 4 orange circles with red borders, 2 gray circle.</p>
+ <p>
+ <span class="image">
+ <svg height="68" width="68" viewBox="-34 -34 68 68">
+ <circle cx="0" cy="0" r="24" fill="#c8c8c8" />
+ </svg>
+ </span>
+ <span class="image">
+ <svg height="68" width="68" viewBox="-34 -34 68 68">
+ <circle cx="0" cy="0" r="24" fill="#c8c8c8" />
+ </svg>
+ </span>
+ <span class="image">
+ <svg height="68" width="68" viewBox="-34 -34 68 68">
+ <circle cx="0" cy="0" r="24" stroke="red" stroke-width="2" fill="orange" />
+ </svg>        
+ </span>
+ <span class="image">
+ <svg height="68" width="68" viewBox="-34 -34 68 68">
+ <circle cx="0" cy="0" r="24" stroke="red" stroke-width="2" fill="orange" />
+ </svg>        
+ </span>
+ <span class="image">
+ <svg height="68" width="68" viewBox="-34 -34 68 68">
+ <circle cx="0" cy="0" r="24" stroke="red" stroke-width="2" fill="orange" />
+ </svg>        
+ </span>
+ <span class="image">
+ <svg height="68" width="68" viewBox="-34 -34 68 68">
+ <circle cx="0" cy="0" r="24" stroke="red" stroke-width="2" fill="orange" />
+ </svg>        
+ </span>
+ <span class="image">
+ <svg height="68" width="68" viewBox="-34 -34 68 68">
+ <circle cx="0" cy="0" r="24" fill="#c8c8c8" />
+ </svg>
+ </span>
+ <span class="image">
+ <svg height="68" width="68" viewBox="-34 -34 68 68">
+ <circle cx="0" cy="0" r="24" fill="#c8c8c8" />
+ </svg>
+ </span>
+ </p>
+ </body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritysvgimagewithcsscrossdomaincss"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/svg-image-with-css-cross-domain.css (0 => 175074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/svg-image-with-css-cross-domain.css         (rev 0)
+++ trunk/LayoutTests/http/tests/security/svg-image-with-css-cross-domain.css        2014-10-22 23:43:11 UTC (rev 175074)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+span {
+ display: inline-block;
+ height: 68px;
+ width: 68px;
+}
+
+span.circle-css-cross-domain {
+ background-image: url('resources/image-with-css-cross-domain.svg');
+}
+
+embed {
+ display: inline-block;
+}
+
+iframe {
+ border-width: 0px;
+}
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritysvgimagewithcsscrossdomainhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/svg-image-with-css-cross-domain.html (0 => 175074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/svg-image-with-css-cross-domain.html         (rev 0)
+++ trunk/LayoutTests/http/tests/security/svg-image-with-css-cross-domain.html        2014-10-22 23:43:11 UTC (rev 175074)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+<!DOCTYPE html>
+<html>
+ <head>
+ <link rel="stylesheet" type="text/css" href="svg-image-with-css-cross-domain.css"/>
+ </head>
+ <body>
+ <h1>WebKit bug</h1>
+ <h3>SVG circle with same-origin and different-origin CSS</h3>
+ <p>Expected: 2 gray circles, 4 orange circles with red borders, 2 gray circle.</p>
+ <p>
+ <span class="image"><img src="resources/image-with-css-cross-domain.svg" alt="circle" width="68" height="68"/></span>
+ <span class="image circle-css-cross-domain"></span>
+ <object data="resources/image-with-css-cross-domain.svg" type="image/svg+xml" width="68" height="68"></object>
+ <embed src="resources/image-with-css-cross-domain.svg" type="image/svg+xml" width="68" height="68"></embed>
+ <iframe src="resources/image-with-css-cross-domain.svg" width="68" height="68"></iframe>
+ <iframe src="resources/image-with-css-cross-domain.svg" width="68" height="68" sandbox=""></iframe>
+ <span class="image"><img width="68" height="68" alt="circle" src="data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+DQo8P3htbC1zdHlsZXNoZWV0IHR5cGU9InRleHQvY3NzIiBocmVmPSJjaXJjbGUuY3NzIj8+DQo8P3htbC1zdHlsZXNoZWV0IHR5cGU9InRleHQvY3NzIiBocmVmPSJodHRwOi8vZG9tMi5jaHJvbWVidWcyLnRlc3QvY2lyY2xlMi5jc3MiPz4NCjxzdmcNCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyINCiAgIHdpZHRoPSI2OCINCiAgIGhlaWdodD0iNjgiDQogICB2aWV3Qm94PSItMzQgLTM0IDY4IDY4Ig0KICAgdmVyc2lvbj0iMS4xIj4NCiAgPGNpcmNsZQ0KICAgICBjeD0iMCINCiAgICAgY3k9IjAiDQogICAgIHI9IjI0Ig0KICAgICBmaWxsPSIjYzhjOGM4Ii8+DQo8L3N2Zz4="/></span>
+         <span class="image">
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <?xml-stylesheet type="text/css" href="circle.css"?>
+ <?xml-stylesheet type="text/css" href="http://localhost:8000/security/circle2.css"?>
+ <svg xmlns="http://www.w3.org/2000/svg" width="68" height="68" viewBox="-34 -34 68 68" version="1.1">
+ <circle cx="0" cy="0" r="24" fill="#c8c8c8"/>
+ </svg>
+ </span>
+ </p>
+ </body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (175073 => 175074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-10-22 23:27:27 UTC (rev 175073)
+++ trunk/Source/WebCore/ChangeLog        2014-10-22 23:43:11 UTC (rev 175074)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2014-10-22 Said Abou-Hallawa <sabouhallawa@apple.com>
+
+ SVG loaded through html <img> can't request to load any external resources.
+ https://bugs.webkit.org/show_bug.cgi?id=137762.
+
+ Reviewed by Daniel Bates.
+
+ SVG images have unique security rules that prevent them from loading any external
+ resources. This patch enforces these rules in CachedResourceLoader::canRequest for
+ all non-data-uri resources.
+
+ The fix and the tests are ported but modified a little from the chromium fix:
+ http://src.chromium.org/viewvc/blink?view=rev&rev=176084
+
+ Test: http/tests/security/svg-image-with-cached-remote-image.html
+ http/tests/security/svg-image-with-css-cross-domain.html
+
+ For the SVG image, prevent loading any external sub-resource except for data urls.
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::canRequest):
+
</ins><span class="cx"> 2014-10-21 Ada Chan <adachan@apple.com>
</span><span class="cx">
</span><span class="cx"> MediaPlayerPrivateAVFoundation::hasAudio() returns false even when there is an audible AVMediaSelectionOption selected
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (175073 => 175074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2014-10-22 23:27:27 UTC (rev 175073)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2014-10-22 23:43:11 UTC (rev 175074)
</span><span class="lines">@@ -35,6 +35,8 @@
</span><span class="cx"> #include "CachedResourceRequest.h"
</span><span class="cx"> #include "CachedScript.h"
</span><span class="cx"> #include "CachedXSLStyleSheet.h"
</span><ins>+#include "Chrome.h"
+#include "ChromeClient.h"
</ins><span class="cx"> #include "ContentSecurityPolicy.h"
</span><span class="cx"> #include "DOMWindow.h"
</span><span class="cx"> #include "Document.h"
</span><span class="lines">@@ -379,6 +381,12 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ // SVG Images have unique security rules that prevent all subresource requests except for data urls.
+ if (type != CachedResource::MainResource && frame() && frame()->page()) {
+ if (frame()->page()->chrome().client().isSVGImageChromeClient() && !url.protocolIsData())
+ return false;
+ }
+
</ins><span class="cx"> // Last of all, check for insecure content. We do this last so that when
</span><span class="cx"> // folks block insecure content with a CSP policy, they don't get a warning.
</span><span class="cx"> // They'll still get a warning in the console about CSP blocking the load.
</span></span></pre>
</div>
</div>
</body>
</html>