<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>156176</bug_id>
          
          <creation_ts>2016-04-04 13:18:26 -0700</creation_ts>
          <short_desc>Investigate letting foreignObject not taint the canvas when drawing svg into canvas.</short_desc>
          <delta_ts>2022-07-18 15:39:00 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>SVG</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=119492</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>91523</blocked>
    
    <blocked>131033</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Philip Rogers">pdr</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>aman62</cc>
    
    <cc>ap</cc>
    
    <cc>bfulgham</cc>
    
    <cc>chrishtr</cc>
    
    <cc>dbates</cc>
    
    <cc>dino</cc>
    
    <cc>fred.wang</cc>
    
    <cc>sabouhallawa</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>thorton</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1180461</commentid>
    <comment_count>0</comment_count>
    <who name="Philip Rogers">pdr</who>
    <bug_when>2016-04-04 13:18:26 -0700</bug_when>
    <thetext>Out of an abundance of caution [1] webkit currently taints the canvas when an svg image containing a foreign object is drawn into the canvas[2]. The core issue is described in https://bugs.webkit.org/show_bug.cgi?id=119492#c33. Blink also has this behavior and we recently reconsidered it in https://crbug.com/294129#c21, but no progress has been made (I will update this bug if there ever is any).

I&apos;d think we should change this, but it&apos;s risky and I haven&apos;t seen a lot of user interest in it.

[1] Getting this wrong has serious issues, see: https://goo.gl/78PwDy
[2] http://trac.webkit.org/browser/trunk/Source/WebCore/svg/graphics/SVGImage.cpp?rev=198655#L85</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1180763</commentid>
    <comment_count>1</comment_count>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2016-04-05 02:22:48 -0700</bug_when>
    <thetext>FWIW, the MDN page: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Drawing_DOM_objects_into_a_canvas</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1180877</commentid>
    <comment_count>2</comment_count>
    <who name="Philip Rogers">pdr</who>
    <bug_when>2016-04-05 11:02:22 -0700</bug_when>
    <thetext>@Frederic, on the webkit-dev thread you asked &quot;Maybe it would be worth checking with them what was their rationale to remove that restriction and if it&apos;s worth following the same approach for Blink/WebKit...&quot;. I think we could remove this restriction today, but I do not trust our implementation of foreignObject to not leak data. This problem is specific to our implementation.

I think a path forward will be to have someone look very closely at &lt;foreignObject&gt; and the data it can leak, and then just flip the switch if it is safe (remove SVGImage::hasSingleSecurityOrigin). For WebKit, I would recommend asking someone on Apple&apos;s security team to sign off on this too. I support doing this, but it&apos;s risky; I haven&apos;t done it myself because there hasn&apos;t been enough user interest to justify it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1261874</commentid>
    <comment_count>3</comment_count>
    <who name="Philip Rogers">pdr</who>
    <bug_when>2016-12-20 19:04:38 -0800</bug_when>
    <thetext>Simon and Said,
I think we&apos;re going to go ahead with this change in Blink (https://groups.google.com/a/chromium.org/d/msg/blink-dev/yYVVl5ociqA/b5387_fKDwAJ). I follow SVG commits in both Blink and WebKit and I do not know of any security/privacy differences in this area. Would you support the same change in WebKit? I can post the patch but wanted to check with you first.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1264240</commentid>
    <comment_count>4</comment_count>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2017-01-05 14:26:53 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; Simon and Said,
&gt; I think we&apos;re going to go ahead with this change in Blink
&gt; (https://groups.google.com/a/chromium.org/d/msg/blink-dev/yYVVl5ociqA/
&gt; b5387_fKDwAJ). I follow SVG commits in both Blink and WebKit and I do not
&gt; know of any security/privacy differences in this area. Would you support the
&gt; same change in WebKit? I can post the patch but wanted to check with you
&gt; first.

I agree with this change since this will make WebKit compliant with the specs and the other browsers. I did a basic testing and I found out WebKt does not apply any linking style when drawing an SVG to a canvas (see attached test case). But I think the WebKit security team needs to sign off on this as well. Brent, do you agree with this change?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1264241</commentid>
    <comment_count>5</comment_count>
      <attachid>298134</attachid>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2017-01-05 14:27:19 -0800</bug_when>
    <thetext>Created attachment 298134
SVG</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1264242</commentid>
    <comment_count>6</comment_count>
      <attachid>298135</attachid>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2017-01-05 14:28:25 -0800</bug_when>
    <thetext>Created attachment 298135
test case</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1264243</commentid>
    <comment_count>7</comment_count>
    <who name="Philip Rogers">pdr</who>
    <bug_when>2017-01-05 14:35:30 -0800</bug_when>
    <thetext>Thanks Said! Small update on the blink side: junov is currently writing a few more tests just to be sure®. I&apos;ll update this bug (along with a link to the patch with tests) once the full change lands in blink.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1398682</commentid>
    <comment_count>8</comment_count>
    <who name="Aman Vishnani">aman62</who>
    <bug_when>2018-02-13 09:55:47 -0800</bug_when>
    <thetext>Hi there,

Any progress on this bug? I came across this bug while using the dom-to-image library for converting an HTML element into a sharable png image. I was hoping that we could make this work without restrictions since Google Chrome and Firefox already allows it.

This issue is similar to https://bugs.webkit.org/show_bug.cgi?id=17352</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1884926</commentid>
    <comment_count>9</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-07-18 15:39:00 -0700</bug_when>
    <thetext>&lt;rdar://problem/97224123&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>298134</attachid>
            <date>2017-01-05 14:27:19 -0800</date>
            <delta_ts>2017-01-05 14:27:19 -0800</delta_ts>
            <desc>SVG</desc>
            <filename>link.svg</filename>
            <type>image/svg+xml</type>
            <size>725</size>
            <attacher name="Said Abou-Hallawa">sabouhallawa</attacher>
            
              <data encoding="base64">PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRw
Oi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDxzdHlsZT4KICAgICAgICBhIHJlY3Qgewog
ICAgICAgICAgICBmaWxsOiBncmVlbiAKICAgICAgICB9IAogICAgICAgIGE6dmlzaXRlZCByZWN0
IHsgCiAgICAgICAgICAgIGZpbGw6IHJlZAogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8YSB4
bGluazpocmVmPSJodHRwczovL3dlYmtpdC5vcmcvIj4KICAgICAgICA8cmVjdCB4PSIwIiB5PSIw
IiB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIvPgogICAgPC9hPgogICAgPGEgeGxpbms6aHJlZj0i
aHR0cDovL3d3dy5leGFtcGxlLmNvbS8iPgogICAgICAgIDxyZWN0IHg9IjExMCIgeT0iMCIgd2lk
dGg9IjEwMCIgaGVpZ2h0PSIxMDAiLz4KICAgIDwvYT4KICAgIDxmb3JlaWduT2JqZWN0IHg9IjAi
IHk9IjExMCIgd2lkdGg9IjIxMCIgaGVpZ2h0PSIxMDAiPgogICAgICAgIDxib2R5IHhtbG5zPSJo
dHRwOi8vd3d3LnczLm9yZy8xOTk5L3hodG1sIj4KICAgICAgICAgICAgPGEgaHJlZj0iaHR0cHM6
Ly93ZWJraXQub3JnLyI+aHR0cHM6Ly93ZWJraXQub3JnLzwvYT4KICAgICAgICAgICAgPGEgaHJl
Zj0iaHR0cDovL3d3dy5leGFtcGxlLmNvbSI+aHR0cDovL3d3dy5leGFtcGxlLmNvbTwvYT4KICAg
ICAgICA8L2JvZHk+CiAgICA8L2ZvcmVpZ25PYmplY3Q+Cjwvc3ZnPgo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>298135</attachid>
            <date>2017-01-05 14:28:25 -0800</date>
            <delta_ts>2017-01-05 14:28:25 -0800</delta_ts>
            <desc>test case</desc>
            <filename>test206.html</filename>
            <type>text/html</type>
            <size>1353</size>
            <attacher name="Said Abou-Hallawa">sabouhallawa</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8Ym9keT4KICAgIDxoMz5pbmxpbmUgc3ZnPC9oMz4KICAg
IDxzdmc+CiAgICAgICAgPHN0eWxlPgogICAgICAgICAgICBhIHJlY3QgewogICAgICAgICAgICAg
ICAgZmlsbDogZ3JlZW4gCiAgICAgICAgICAgIH0gCiAgICAgICAgICAgIGE6dmlzaXRlZCByZWN0
IHsgCiAgICAgICAgICAgICAgICBmaWxsOiByZWQKICAgICAgICAgICAgfQogICAgICAgIDwvc3R5
bGU+CiAgICAgICAgPGEgeGxpbms6aHJlZj0iaHR0cHM6Ly93ZWJraXQub3JnLyI+CiAgICAgICAg
ICAgIDxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAiIGh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