WICG / private-network-access

https://wicg.github.io/private-network-access/
Other
58 stars 22 forks source link

Please clarify the use of the Vary header in examples #78

Closed jub0bs closed 2 years ago

jub0bs commented 2 years ago

Examples 2 and 3 both use the Vary header in the response to the preflight request:

Vary: Origin

Could you clarify your decision to include that header in the response, as well as motivate its value (Origin)?

Although responses to OPTIONS requests are not supposed to be cached (outside browsers' preflight cache, of course), some questionable Web caches do allow users to cache such responses. In that case, it would make sense to specify a Vary header in responses to preflight requests.

However, in that case, shouldn't Access-Control-Request-Method, Access-Control-Request-Headers, and Access-Control-Request-Private-Network also be listed in the Vary header? Unless those three request headers do not affect the response, they would become part of the cache-poisoning attack surface if they're not listed in the Vary header.

Under the assumption that a Web cache is in place and caches responses to preflight requests, I would have expected

Vary: Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Request-Private-Network

Otherwise, I wouldn't expect the need for any Vary header at all.

letitz commented 2 years ago

I tend to agree. Appealing to @mikewest who wrote these examples. WDYT?

mikewest commented 2 years ago

I don't remember any specific reason for including the header in the example. Removing it sounds fine to me.

letitz commented 2 years ago

Thanks! I'll land a fix.