-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSP policies for WebTransport? #59
Comments
Possibly related to (or a specific issue in) Issue #13 |
Discussed on December 8, 2020 WebTransport WG meeting. Agreement to support CSP for the Web PKI case. Concerns over impact of fingerprint verification on CSP support. |
@vasilvv to write text and reach out to webappsec to discuss some of the more complex cases. |
So I think the answer for WebPKI-authenticated connections is fairly clear: we will check For the connections that are anchored against a custom certificate, I can see a few approaches:
The first approach has the advantage of being very simple, but less powerful, as it's just an all-or-nothing approach. The second approach lets developers control the specific fingerprints, but it does require us to do more work. Notably, I have no idea what the policies are wrt assigning cc @mikewest since he expressed interest in this topic in the past. |
The discussions on webrtc-src are relevant here: w3c/webappsec-csp#457 I would say that a binary toggle for "custom certificate allowed" is probably easier than otherwise. Reconciling that with the WebRTC control would be ideal. Devising a new means of identifying specific certificates, similar to script-src with nonces, seems like a stretch goal. You might consider a webtransport-src rule that inherits from connect-src. |
Meeting:
|
One addendum: just use a boolean flag ('fp') to turn custom certificate fingerprints on/off rather than devise a system for identifying specific fingerprints (do that later). |
As I mentioned in one of the WebRTC threads, I think acting as if "obtaining the connection" failed is preferable as it gives more freedom to where implementations decide to enforce the policy and makes the API contract for developers simpler. |
Seconding @annevk; we started enforcing on |
So a new way to reject the ready promise? |
Assuming the description at https://w3c.github.io/webtransport/#webtransport-ready is correct, yes. Using the same exception you do now to reject on connection establishment failure. ( |
@yutakahirano With #367 merged can this be closed now, or was it left open for a reason? My understanding of that PR is that we now link to CSP and that the details of how that policy works will be handled there. Is that right? |
The interaction between custom certificates hasn't been resolved yet, IIRC. |
Regarding the issue with custom certificates, I've been trying to figure the exact threat model for this issue. The model I currently have in my head is roughly: if an attacker can inject code into the webpage, and they can do active network attacks, then they can work around CSP policies (such as A simple flag to control this was the approach we've agreed to last time we discussed this during a WG meeting, and I think it should be sufficient. We still need to figure out the placement and syntax for this; as a starting point, I am going to suggest adding a |
Alternatively, could we add an HTTP header to the extended CONNECT request that mentions whether custom certificates were configured by the client JavaScript? That way server implementations could be configured by default to abort if that header is present. |
I'm a fan of a new 'certificate-hash' label for 'connect-src' and friends, which would be off by default and so cascade down naturally (being disabled automatically if CSP rules were in play). |
That would be a good approach, though I am not sure this is backwards-compatible, i.e. if a website sends |
That form of compatibility is fairly simple. Under (my understanding of1) the CSP extension model, new directive values can only be more permissive, so it is safe to ignore unknown values. The sort of compatibility problem that concerns me is the one where we ship the capability, then attempt to retrofit CSP to it. There, sites will exist that use Footnotes
|
Meeting:
|
Meeting:
|
Meeting:
|
@vasilvv did you have time to look over the CSP spec? Can we close this now? |
Discussed this with @vasilvv offline, and it's not clear if the current state is sufficient or we need to add anything to the CSP spec. Maybe worth discussing at the next meeting. |
Meeting:
|
From #59 (comment) it looked like we were almost home:
@vasilvv do we still think |
Meeting:
|
Based on chrome status it doesn't seem too late to do this. From my (limited) understanding of CSP keywords, we'd need to define the keyword's interaction with other sources: Content-Security-Policy: connect-src 'certificate-hash' https://A.com https://B.com Clearly, this would disallow new WebTransport("https://C.com"); // C is not A or B But would it also disallow new WebTransport("https://C.com", {serverCertificateHashes: [{algorithm: "sha-256", value}]}); ? If there's security value in limiting connects to specific URLs even without Web PKI, then probably yes. |
Even if we do limit use of serverCertificateHashes to those URLs (A and B), there's no way to limit it just to A (and still allow B with TLS). That would probably require an independent directive instead. Something like:
|
Meeting:
|
|
Currently, data exchange capabilities that are exposed to the Web are restricted through CSP connect-src, which restricts which origins can be connected to through WebSockets, XHR, etc.
The text was updated successfully, but these errors were encountered: