w3c / resource-timing

Resource Timing
https://w3c.github.io/resource-timing/
Other
120 stars 35 forks source link

Allow semi-wildcard `Timing-Allow-Origin` values (for subdomains) #175

Open jakub-g opened 5 years ago

jakub-g commented 5 years ago

4.5.1 Timing-Allow-Origin Response Header ... If the Timing-Allow-Origin header value list contains a case-sensitive match for the value of the origin of the current document, or a wildcard ("*"), return pass.

With the current state of the art, it's possible to return TAO values like:

It's not possible to specify "semi-wildcard" values to allow subdomains of a given domain, like:

Was this use case ever considered? Are there any reasons to not allow it like this? (it would add a bit more complexity to the spec and implementations, but nothing unreasonable).

A scenario I'm thinking about is:

We could argue that in the CDN scenario with static responses it's probably (most of the time) not a big deal to allow * origins, so maybe the example I made up is a bit artificial. But I still think that in some environments, it might be easier to convince ops people to activate the header on *.mydomain.com than on * -- it would require less analysis from security point of view to have it approved.

toddreifsteck commented 5 years ago

Needs a careful security/privacy review. If those can be resolved, this seems like useful syntactic sugar.

cvazac commented 5 years ago

There seem to be clear use cases for leading (*.example.com) and trailing wildcards (www.example.*). Is there a use case for wildcard somewhere in the middle?