Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace canvas' "origin-clean" concept with something less origin specific #2813

Closed
jakearchibald opened this issue Jul 5, 2017 · 8 comments
Labels
security/privacy There are security or privacy implications topic: canvas

Comments

@jakearchibald
Copy link
Contributor

https://html.spec.whatwg.org/multipage/canvas.html#the-image-argument-is-not-origin-clean

The spec currently uses the origin of the image resource to determine if the resource taints the canvas or not.

It kinda hand-waves that the image has an origin, which isn't accurate enough, especially considering redirects and service workers.

This should be replaced by flags on images & videos to indicate they hold opaque content, which is judged by the current resource using CORS-cross-origin responses (the naming of this is misleading, but we can rename that some other time).

This means that <img crossorigin> resources can be drawn to the canvas without tainting despite being from another origin. This appears to be how browsers behave anyway.

I'm going to spec this flag for media elements as I need it for something else.

@jakearchibald
Copy link
Contributor Author

Fixing this would also help with #1431.

@annevk
Copy link
Member

annevk commented Jul 5, 2017

@annevk annevk added security/privacy There are security or privacy implications topic: canvas labels Jul 5, 2017
@jakearchibald
Copy link
Contributor Author

Cheers! I figured someone must have already picked up on this.

https://html.spec.whatwg.org/multipage/media.html#loading-the-media-resource contradicts the canvas spec on this:

It can be CORS-same-origin or CORS-cross-origin; this affects whether subtitles referenced in the media data are exposed in the API and, for video elements, whether a canvas gets tainted when the video is drawn on it.

@junov
Copy link
Member

junov commented Jul 5, 2017

+1
The concept represented by the origin-clean flag is not origin cleanliness. What the flag really means is: "is script allowed to access the content". The reasons for blocking access (e.g. cross-origin) are not really important to the semantics of the flag. Not sure how to express that precisely in a concise flag name.
Perhaps: content-access-allowed

@jakearchibald
Copy link
Contributor Author

FWIW I'm going for "uses opaque data flag" for media elements. I'm using it to ensure opaque responses aren't mixed with content from other sources, so it isn't strictly about content-access.

@junov
Copy link
Member

junov commented Jul 5, 2017

The term opaque is ambiguous when talking about pixel data (could mean "no alpha channel").

@jakearchibald
Copy link
Contributor Author

Oh bollocks yeah. Hmm. That's what the fetch spec calls it though. Maybe "uses opaque response flag" to make the link to fetch clear.

@junov
Copy link
Member

junov commented Jul 5, 2017

Naming things is hard... :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
security/privacy There are security or privacy implications topic: canvas
Development

No branches or pull requests

4 participants
@jakearchibald @annevk @junov and others