Open wanderview opened 6 years ago
(Note that I've found at least one case where we have to inherit into dedicated workers (though alternatively we could treat this header as setting a policy for the agent cluster, which seems somewhat attractive in a way and would sidestep this inheritance question): Upgrade-No-CORS
.)
- referrer policy: I believe referrer policy is inherited from documents to a dedicated worker, but I'm less sure about this one.
In the current HTML spec, a dedicated worker doesn't inherit its parent's referrer policy (whatwg/html#3270)
- Special case logic is required in implementations resulting in brittleness and increased security risk. (Many of the policies have security implications.)
+1. This inconsistency makes the Blink implementation and WPT complicated. cc: @hiroshige-g
@nhiroki did you see https://github.com/whatwg/html/issues/4916?
@annevk Sorry for the late reply. Yes, I read the issue.
I heard there was a discussion about the policy inheritance at TPAC from @hiroshige-g. I'll update/close whatwg/html#3270 based on the final decision.
We (mainly @mikewest @annevk @wanderview @hiroshige-g) had a discussion around TPAC 2019, and reached a consensus:
NOT to inherit parent context's policy, except for <iframe srcdoc>
,
<iframe src="about:blank">
, data:
dedicated workers etc., and use the same inheritance rule across policies (CSP, referrer policy, etc).
@annevk's https://github.com/whatwg/html/issues/4926 is based on the discussion.
More detailed summary is here: https://docs.google.com/document/d/1CAegq63QY0HMW-66zG4wgawIaWGi33MHtmU3azQQNz8/edit?usp=sharing
@annevk please let me know if I'm missing something or not summarizing correctly.
Thanks for writing that up @hiroshige-g, looks good to me!
@kenchris and I took a look at this during the TAG F2F this week. We're really happy that the TPAC discussion was so fruitful. We'll hold off on adding something to the Design Principles document until whatwg/html#4926 is resolved. Thanks!
FYI some updates: I'm doing some investigation to see how policies etc. are set in different contexts and how (in)consistent they are. I've found some issues (e.g. https://github.com/whatwg/html/issues/5474 https://github.com/whatwg/html/issues/421) but they look relatively minor.
I also investigated the of feasibility of changing CSP inheritance rule. Originally I was wondering comparing CSPs of parent Documents and worker script's response headers and seeing whether they are the same, but when I looked at some major websites, they set different policies (due to nonce, due to minor diffs, or just setting completely different CSPs).
@hiroshige-g Do you think some recommendations can be crafted from your investigation? In which case what would they be?
Friendly ping @hiroshige-g !
There are a number of places in the web platform where some policy or state is inherited from one context to another. Its up to each feature in the platform to define how it gets inherited or not. The result is that there are a number of inconsistent inheritance behaviors.
Some downsides of this inconsistent behavior are:
It might be nice to have some guidance on how inheritance should work on the web platform to produce a more consistent system.
Off the top of my head I can think of the following types of inheritance:
createObjectURL()
was called.There are probably more cases to consider.
My personal preference would be to make all inheritable attributes align to the same source. So if a local URL inherits an origin from a context, then all other attributes are inherited from that same source context. If a context has its own URL that defines its own origin, then nothing is inherited from other contexts.
Thanks for your help sorting this out!