This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 21506 - Data URLs should not inherit the origin after a redirect.
Summary: Data URLs should not inherit the origin after a redirect.
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-02 09:31 UTC by contributor
Modified: 2013-09-12 20:16 UTC (History)
5 users (show)

See Also:


Attachments

Description contributor 2013-04-02 09:31:09 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/origin-0.html
Multipage: http://www.whatwg.org/C#sandboxOrigin
Complete: http://www.whatwg.org/c#sandboxOrigin

Comment:
Data URLs should not inherit the origin after a redirect.

Posted from: 207.218.72.65 by annevk@annevk.nl
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:20.0) Gecko/20100101 Firefox/20.0
Comment 1 Anne 2013-04-02 09:33:15 UTC
Consider a cross-origin URL that redirects to a same-origin URL open redirector. The cross-origin URL can cause the same-origin URL redirector to output a data URL that might harm the site in question.

I hope to clarify this in Fetch too, but updating HTML meanwhile might be good.
Comment 2 Boris Zbarsky 2013-04-02 14:46:05 UTC
Note that in Gecko, redirects to a data: URL do not in fact inherit any origins, last I checked.
Comment 3 Ian 'Hixie' Hickson 2013-04-09 17:57:44 UTC
As far as I can tell, the spec already says that. Specifically, it has this entry:

   If a Document was generated from a data: URL that was
   returned as the location of an HTTP redirect (or
   equivalent in other protocols)

      The origin is an alias to the origin of the URL that
      redirected to the data: URL.

Anne: Am I missing something?
Comment 4 Boris Zbarsky 2013-04-09 17:59:18 UTC
This is a bug about having it NOT be an alias and instead having it be a new uniquer origin, as far as I can tell.
Comment 5 Anne 2013-04-09 18:12:38 UTC
Indeed. Also, that does not address the case for <img>, <script>, and other sources that take a data URL.
Comment 6 Ian 'Hixie' Hickson 2013-04-12 06:58:15 UTC
Oh, I see. Yeah, that seems reasonable.
Comment 7 Ian 'Hixie' Hickson 2013-05-31 20:12:27 UTC
Aren't <img> and <script> already handled by the potentially-CORS logic?
Comment 8 contributor 2013-05-31 20:13:19 UTC
Checked in as WHATWG revision r7881.
Check-in comment: Security: data: URLs shouldn't get the origin of a redirector, since that redirector might be tricked into redirecting a data: URLs by a hostile origin, thus letting that hostile origin expose a same-origin data: URL.
http://html5.org/tools/web-apps-tracker?from=7880&to=7881
Comment 9 Ian 'Hixie' Hickson 2013-06-12 19:06:07 UTC
I've only done the definition for Documents. Let me know if I need to do more, I couldn't work out what you meant for <img> etc.
Comment 10 Boris Zbarsky 2013-06-13 15:53:03 UTC
I think the question is what happens if you have a cross-origin image load that redirects to a data URL.  And the answer is that the resulting image should NOT be considered same-origin with the linking document for things like canvas tainting and whatnot. 

As long as this is what happens now, we're good.
Comment 11 Ian 'Hixie' Hickson 2013-06-17 22:17:52 UTC
Well as soon as you go cross-origin, it ends up not being same-origin, so I don't think the problem occurs. (Only way I guess it could occur is if the CORS headers from the redirect somehow applied to the data: URL, but I don't think that happens. If it does, it'd be a bug in CORS, not HTML.)
Comment 12 Anne 2013-06-19 06:11:13 UTC
Do we want same-origin -> data URLs to be considered same-origin though? I thought that was a case we did not want to allow.
Comment 13 Ian 'Hixie' Hickson 2013-07-02 22:01:38 UTC
Why would we not want to allow it?
Comment 14 Anne 2013-08-08 13:59:08 UTC
The one I see is a page that allows pasting in same-origin links that open in an <iframe> of sorts and they also have an open-re-director going.
Comment 15 Ian 'Hixie' Hickson 2013-08-08 22:07:08 UTC
I don't think I've ever seen such a page, but I dunno... Do you have an example?
Comment 16 Ian 'Hixie' Hickson 2013-08-08 22:07:36 UTC
(It would have to be a page that does that, but still blocks direct data: URLs.)
Comment 17 Ian 'Hixie' Hickson 2013-09-12 20:16:05 UTC
For Documents, even same-origin redirects to data: end up with a unique origin.
For images, we're already treating them specially in HTML, and the fetch spec is taking that over anyway.

I think we're done here. Reopen if I missed something.