[whatwg] Redirect handling for <audio> & <video>
philipj at opera.com
Thu Mar 10 00:12:00 PST 2011
On Wed, 09 Mar 2011 19:48:30 +0100, Aaron Colwell <acolwell at google.com>
> Thanks for your response.. comments inline
> On Fri, Mar 4, 2011 at 1:30 AM, Philip Jägenstedt <philipj at opera.com>
>> On Thu, 03 Mar 2011 22:15:58 +0100, Aaron Colwell <acolwell at google.com>
>>> I was looking at the resource fetch
>>> and fetching
>>> resources <
>>> sections of the HTML5 spec to determine what the proper behavior is for
>>> redirects. Both YouTube and Vimeo do 302 redirects to different
>>> the URLs specified in the src attribute. It looks like the spec says
>>> playback should fail in these cases because they are from different
>>> origins (Section 2.7 Fetching resources bullet 7). This leads me to a
>>> 1. Is my interpretation of the spec correct? Sample YouTube & Vimeo
>>> shown below.
>>> YouTube : src : http://v22.lscache6.c.youtube.com/videoplayback?
>>> redirect :
>>> Vimeo : src : http://player.vimeo.com/play_redirect? ...
>>> redirect : http://av.vimeo.com/05 ...
>> Yes, from what I can tell you're correct, but I think it's not
>> The behavior was changed by <http://html5.org/r/5111> in 2010-06-25, and
>> this is the first time I've noticed it. Opera (and I assume most if not
>> other browsers) already supports HTTP redirects for <video> and I don't
>> think it makes much sense to disallow it. For security purposes, the
>> of the resource is considered to be the final destination, not any of
>> origins in the redirect chain.
>> I agree that redirects should be allowed, but it seems like the force
> same-origin flag was introduced to limit the types of redirects. The
> & Vimeo cases mentioned above seem reasonable, but redirects from
> vimeo.comto malicious-site.com might not be ok.
As far as I can tell, there's no difference between the YouTube/Vimeo
cases and redirecting to malicious-site.com. In both cases, they redirect
to another origin, so the exact same thing should happen. Besides, if a
good site redirects to an evil site, that's your problem right there. The
only issue I'm aware of is if an evil site redirecting to good site, in
the hope that the origin of the resource would still be considered evil
site, so that they can read out pixel data, etc. That would be a browser
> It looks like the changes reference CORS
> as a future solution. Do you have any CORS references that might be
Nothing beyond <http://www.w3.org/TR/cors/>, no. Anne is the editor and is
on this list so he'll know more if you have specific questions.
> You also mentioned that the final destination is what should be used for
> security. It seems like this could cause problems for canvas.drawImage()
> when trying copy video data to the canvas. If I understand you correctly
> page on YouTube would have to come from the final destination origin to
> allow canvas.drawImage() to work. Is that correct?
The details of this is outlined in
The case you mention is this one:
"The element's 2D context's drawImage() method is called with an
HTMLImageElement or an HTMLVideoElement whose origin is not the same as
that of the Document object that owns the canvas element."
However, since the spec now says that redirecting video cross-origin
should just fail, it doesn't match what at least Opera actually does here.
>> 2. What about http: -> https: redirects? Some content is required to be
>>> only via https and this sort of redirect enforces that but isn't
>>> different origin.
>> Quoting <
>> "two URLs are part of the same origin (i.e., represent the same
>> if they have the same scheme, host, and port"
>> Since both the scheme (http vs https) and port (80 vs 443) would be
>> different, it's considered a different origin.
> I think I made some poor word choices here. I agree that they are
> origins because the scheme and port are different. I was just trying to
> at the fact they still referred to the same content just over a secure
> connection. It seems like there are use cases where a set of <scheme,
> port> tuples should be considered a single origin from a security point
> view. It just isn't clear to me how we are supposed to express that.
What problem does this solve, though?
>> 3. If my interpretation of the spec is correct, are there proposals to
>>> change this
>>> or other specs that allow content providers to signal that these
>>> different hostnames
>>> actually represent the same "origin".
>> I think the force same-origin flag introduced by
>> should be removed from the resource fetch algorithm, but the http vs
>> origin issue is not something that can really be changed.
> So what is the process for proposing this type of change? Is this the
> Why is allowing redirects with the same scheme but different hosts ok,
> redirecting different schemes with the same host not ok? I'm new to this
> I'm just trying to understand.
There is no strict process here, but I suppose if you want to change or
invent new security models, this is as good a forum as any. Step 1 would
be explaining what the problem you want to solve is, not a specific
solution you have in mind.
More information about the whatwg