-
Notifications
You must be signed in to change notification settings - Fork 23
Preload and CSP #37
Comments
What needs to happen first is that preload becomes defined in terms of Fetch. Including the concept of "preload store" and such. Then we can more clearly think through what invariants these concepts need to hold in order for things to be secure. (What I think we concluded last time is that if "as" basically sets request's "type", which seems desirable, the preload store needs to store the "type" along with any data you want to key on, otherwise CSP could be bypassed which would be bad.) |
Preload is defined in terms of fetch: https://w3c.github.io/preload/#dfn-obtain-the-preload-resource. You're right that we still need to add the plumbing for preload store, but I don't think that's a blocking concern for this discussion -- we'll need to make sure that appropriate CSP checks are applied when a response is retrieved from the store, but the question we're trying to address here is whether it can get into that store in the first place (step 4 in above processing section).
I think we've already ruled this out. In practice this would mean that connect-src would become a union of all other policies, which is not the outcome we want.
Right, this is a continuation of whatwg/fetch#93 (comment). Current mapping of Here's an attempt at defining a separate |
bump @annevk :) |
I don't understand what this means. I think I stand by my original assertion that defining the characteristics of the store is important in order to figure out whether or not we need a new column. |
@annevk as in, whether the request is made in the first place... if the request is blocked by relevant policy, then there is nothing to store. Hence my comment that current mapping of as to #concept-request-type is not sufficient to enforce CSP checks before the request goes out. |
Why is that not sufficient? |
Because some of the current Take a look at the table here, where I added |
Hmm, I think it's a bug in CSP that it doesn't use |
If we can resolve 1 and 3, then I think mapping |
What would you want to preload in object/embed going forward? They're practically obsolete. |
Adding Ted from CSP to make him aware. @teddink |
Looking at the table @igrigorik linked to and following a few conversations I had on the subject, I think there are a bunch of resource types that we would need to address:
|
|
OK, so if I want to download an arbitrary piece of data to be then fetched from JS, I just leave
I'm not sure I understand what you mean there. Do you suggest adding a
The crux of the approach there is that
OK |
Oooh, I think I understand. It seems better to use |
One more related issue that comes to mind - what would happen when at some point we would need to add a new type So, developers have to allow this resource to be downloaded in two separate directives, for a few years. Not very future friendly. |
Isn't that always the case? |
Yeah, on second thought it's probably not a big deal. |
I'm not sure if The contents of an SVG image embedded using
I discussed that use case in a previous article, and mentioned why it would be useful to have a way to specify multiple SVG sources when using That’s the extent of knowledge I can contribute here. I don't know how relevant the "multiple sources for |
Stepping back for a sanity check on what we're trying to achieve here:
What we need to resolve here is:
FWIW, I don't think this is the right forum to discuss whether object/embed has a long-term future in the platform.. It exists, developers use it, and we should support those use cases in preload. Once and if that gets deprecated, we can figure out how and if it affects Fetch+Preload. Concretely, to resolve this issue, we need to extend Fetch |
They are supported, just not as first-class citizens. |
@annevk poor language on my part.. The application can fetch assets under |
I don't follow your line of reasoning. You're making it seem as if "CSP" has the right answers here whereas it will lead to wrong answers for other things. E.g., |
No, and that's not the intent. All I'm saying is, developers have existing methods to fetch resources that fall under (and apologies upfront if I'm still missing your point :)) |
I don't have any opinions about spec-editing issues like what gets specified where or how. It does make sense to me that for something like I assume that either way, if a document contains a But really, this seems like a discussion for the webappsec WG? |
Yup. Sounds good to me. |
But to be clear, I don't think this requires adding CSP to the fetch spec if Anne wants to avoid that. (But I might very well be misunderstanding Anne's concern) |
Some of these questions can be raised for Sub-Resource Integrity as well. |
@kravietz separate thread: w3c/webappsec-subresource-integrity#26 @sicking right, I'm not proposing we make CSP a first-class citizen in fetch. Rather, I'm just pointing out that current definition of |
One more point - while applying the connect-src directive to empty type preloads it came up that CSP changes would be required unless we make sure that the "destination" of such empty type preloads is a "subresource". We should define it as such for the purpose of |
Opened #55 to track the developer use cases. Let's solve that and then come back and revisit the CSP integration bits. |
Resolved via #57, closing. |
We've ran a few laps around the track with regard to the CSP context that
preload
based resources should be requested with.AFAIK, we now have a few non-ideal options in front of us:
as
value - the problem with that is that thescript
as
value can map to multiple directives (script-src
,child-src
and whatever would be the directive for service worker).connect-src
and let the consumer enforce the actual policy - that forces authors to define bothconnect-src
and the actual directive for the same resource path, which complicates CSP directive creation.I think that the first option is the least evil and can be resolved by adding a
worker-script
type or something along those lines.Thoughts?
/cc @igrigorik @mikewest @annevk
The text was updated successfully, but these errors were encountered: