Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Issue 22604008: Allow SVG images to not taint the canvas with drawImage/drawPattern (Closed)

Created:
7 years, 4 months ago by pdr.
Modified:
7 years, 4 months ago
CC:
blink-reviews, eae+blinkwatch, leviw+renderwatch, dglazkov+blink, f(malita), adamk+blink_chromium.org, jchaffraix+rendering, pdr, Stephen Chennney
Visibility:
Public.

Description

Allow SVG images to not taint the canvas with drawImage/drawPattern This is a merge of http://trac.webkit.org/changeset/153876 by Timothy Hatcher with a large modification to prevent leaks through embedded images. In SVGImage::hasSingleSecurityOrigin, this patch checks that the SVG image does not contain other images. I've reported this to the WebKit team in wkbug.com/119639 The main idea in this patch is to allow single origin images to be drawn into a canvas by checking SVGImage::hasSingleSecurityOrigin(). At the moment we are blacklisting <foreignObject>, <image>, and <feImage>. A leak of data is possible through SVG's <a> element, and this patch disables <a> in both HTML and SVG if the content is embedded through an SVG image (one day, we may white-list <foreignObject>). BUG=249037 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=156422

Patch Set 1 #

Total comments: 8

Patch Set 2 : Address reviewer comments #

Total comments: 2

Patch Set 3 : Address reviewer comments #

Patch Set 4 : Update tests for bot happiness #

Patch Set 5 : Rebase after r156375 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+207 lines, -136 lines) Patch
M LayoutTests/TestExpectations View 1 2 3 4 1 chunk +0 lines, -1 line 0 comments Download
D LayoutTests/fast/canvas/svg-taint.html View 1 chunk +0 lines, -46 lines 0 comments Download
D LayoutTests/http/tests/security/canvas-remote-read-data-url-svg-image.html View 1 chunk +0 lines, -40 lines 0 comments Download
D LayoutTests/http/tests/security/canvas-remote-read-svg-image.html View 1 chunk +0 lines, -33 lines 0 comments Download
A LayoutTests/svg/as-image/resources/link.svg View 1 2 3 1 chunk +8 lines, -0 lines 0 comments Download
A LayoutTests/svg/as-image/resources/link-xhtml.svg View 1 2 3 1 chunk +8 lines, -0 lines 0 comments Download
A LayoutTests/svg/as-image/resources/svg-with-image-with-link.svg View 1 2 3 1 chunk +7 lines, -0 lines 0 comments Download
A LayoutTests/svg/as-image/svg-canvas-link-not-colored.html View 1 2 3 1 chunk +39 lines, -0 lines 0 comments Download
A LayoutTests/svg/as-image/svg-canvas-link-not-colored-expected.txt View 1 chunk +7 lines, -0 lines 0 comments Download
A + LayoutTests/svg/as-image/svg-canvas-not-tainted.html View 1 2 3 2 chunks +7 lines, -6 lines 0 comments Download
A LayoutTests/svg/as-image/svg-canvas-not-tainted-expected.txt View 1 chunk +2 lines, -0 lines 0 comments Download
A LayoutTests/svg/as-image/svg-canvas-svg-with-image-with-link-tainted.html View 1 2 3 1 chunk +31 lines, -0 lines 0 comments Download
A LayoutTests/svg/as-image/svg-canvas-svg-with-image-with-link-tainted-expected.txt View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
A LayoutTests/svg/as-image/svg-canvas-xhtml-tainted.html View 1 2 3 1 chunk +31 lines, -0 lines 0 comments Download
A LayoutTests/svg/as-image/svg-canvas-xhtml-tainted-expected.txt View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/dom/Node.h View 1 1 chunk +1 line, -3 lines 0 comments Download
M Source/core/dom/Node.cpp View 1 2 3 chunks +7 lines, -0 lines 0 comments Download
M Source/core/html/HTMLAnchorElement.cpp View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/html/HTMLImageElement.cpp View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/rendering/svg/RenderSVGRoot.cpp View 1 2 3 4 2 chunks +2 lines, -7 lines 0 comments Download
M Source/core/svg/graphics/SVGImage.h View 2 chunks +5 lines, -0 lines 0 comments Download
M Source/core/svg/graphics/SVGImage.cpp View 1 2 3 4 3 chunks +46 lines, -0 lines 0 comments Download

Messages

Total messages: 19 (0 generated)
pdr.
7 years, 4 months ago (2013-08-12 03:57:02 UTC) #1
abarth-chromium
https://codereview.chromium.org/22604008/diff/1/Source/core/html/HTMLImageElement.cpp File Source/core/html/HTMLImageElement.cpp (right): https://codereview.chromium.org/22604008/diff/1/Source/core/html/HTMLImageElement.cpp#newcode118 Source/core/html/HTMLImageElement.cpp:118: setIsLink(!value.isNull() && !shouldProhibitLinks(this)); Can we have an ASSERT in ...
7 years, 4 months ago (2013-08-12 19:47:43 UTC) #2
abarth-chromium
I feel like we need a thumbs up from the security team for this CL. ...
7 years, 4 months ago (2013-08-12 20:02:56 UTC) #3
pdr.
On 2013/08/12 20:02:56, abarth wrote: > I feel like we need a thumbs up from ...
7 years, 4 months ago (2013-08-14 22:03:49 UTC) #4
Tom Sepez
https://codereview.chromium.org/22604008/diff/1/Source/core/html/HTMLAnchorElement.h File Source/core/html/HTMLAnchorElement.h (right): https://codereview.chromium.org/22604008/diff/1/Source/core/html/HTMLAnchorElement.h#newcode160 Source/core/html/HTMLAnchorElement.h:160: bool shouldProhibitLinks(Element*); nit: mustProhibitLinks() https://codereview.chromium.org/22604008/diff/1/Source/core/svg/graphics/SVGImage.cpp File Source/core/svg/graphics/SVGImage.cpp (right): https://codereview.chromium.org/22604008/diff/1/Source/core/svg/graphics/SVGImage.cpp#newcode100 ...
7 years, 4 months ago (2013-08-15 17:53:59 UTC) #5
pdr.
On 2013/08/15 17:53:59, Tom Sepez wrote: > https://codereview.chromium.org/22604008/diff/1/Source/core/html/HTMLAnchorElement.h > File Source/core/html/HTMLAnchorElement.h (right): > > https://codereview.chromium.org/22604008/diff/1/Source/core/html/HTMLAnchorElement.h#newcode160 ...
7 years, 4 months ago (2013-08-15 20:55:08 UTC) #6
Tom Sepez
On 2013/08/15 20:55:08, pdr wrote: > On 2013/08/15 17:53:59, Tom Sepez wrote: > > > ...
7 years, 4 months ago (2013-08-15 21:02:00 UTC) #7
pdr.
On 2013/08/12 19:47:43, abarth wrote: > https://codereview.chromium.org/22604008/diff/1/Source/core/html/HTMLImageElement.cpp > File Source/core/html/HTMLImageElement.cpp (right): > > https://codereview.chromium.org/22604008/diff/1/Source/core/html/HTMLImageElement.cpp#newcode118 > ...
7 years, 4 months ago (2013-08-16 21:19:17 UTC) #8
abarth-chromium
On 2013/08/16 21:19:17, pdr wrote: > This is tricky because Node::setIsLink can't access the toElement ...
7 years, 4 months ago (2013-08-19 18:13:32 UTC) #9
pdr.
https://codereview.chromium.org/22604008/diff/1/Source/core/html/HTMLAnchorElement.h File Source/core/html/HTMLAnchorElement.h (right): https://codereview.chromium.org/22604008/diff/1/Source/core/html/HTMLAnchorElement.h#newcode160 Source/core/html/HTMLAnchorElement.h:160: bool shouldProhibitLinks(Element*); On 2013/08/15 17:53:59, Tom Sepez wrote: > ...
7 years, 4 months ago (2013-08-19 23:16:16 UTC) #10
abarth-chromium
LGTM I suspect we'll have some security bugs in this feature over time, but the ...
7 years, 4 months ago (2013-08-19 23:54:36 UTC) #11
pdr.
On 2013/08/19 23:54:36, abarth wrote: > LGTM > > I suspect we'll have some security ...
7 years, 4 months ago (2013-08-20 06:59:13 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pdr@chromium.org/22604008/26001
7 years, 4 months ago (2013-08-20 07:07:10 UTC) #13
abarth-chromium
On 2013/08/20 06:59:13, pdr wrote: > I think this is handled with the m_page check, ...
7 years, 4 months ago (2013-08-20 07:17:28 UTC) #14
commit-bot: I haz the power
Failed to apply patch for Source/core/rendering/svg/RenderSVGRoot.cpp: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file ...
7 years, 4 months ago (2013-08-20 08:55:46 UTC) #15
pdr.
On 2013/08/20 07:17:28, abarth wrote: > On 2013/08/20 06:59:13, pdr wrote: > > I think ...
7 years, 4 months ago (2013-08-20 17:29:18 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pdr@chromium.org/22604008/40001
7 years, 4 months ago (2013-08-20 18:55:56 UTC) #17
abarth-chromium
We talked in person. We agreed that the is correct as written today but that ...
7 years, 4 months ago (2013-08-20 19:31:54 UTC) #18
commit-bot: I haz the power
7 years, 4 months ago (2013-08-21 02:54:22 UTC) #19
Message was sent while issue was closed.
Change committed as 156422

Powered by Google App Engine
This is Rietveld 408576698