Add 'unsafe-webtransport-hashes' keyword to connect-src#791
Add 'unsafe-webtransport-hashes' keyword to connect-src#791
Conversation
antosart
left a comment
There was a problem hiding this comment.
Do we also need to adapt the post-request check? The interaction between fetch an webtransport is not totally clear to me, but I guess it would also go through https://fetch.spec.whatwg.org/#ref-for-should-block-response%E2%91%A0 ?
|
Also, we probably need WPTs. @mikewest after conversations at TPAC, do we already have an updated process for changes to the spec? |
|
No, it's been on my list since TPAC, but I haven't gotten a proposal out yet. Certainly will require WPT coverage and signals from other vendors, though. I think we have the latter here, but not the former? |
|
I've added the post-request check and used " (Unless there are any takers) I'll work on WPT next! |
|
Build is failing on "No 'dfn' refs found for 'webtransport-hashes'" which are provided by whatwg/fetch#1896. WPT tests are in https://phabricator.services.mozilla.com/D276378. |
|
Thank you. Let's wait for whatwg/fetch#1896. to be merged then. A comment on the WPT, which I'll leave here for simplicity: Could you wait for the violation to be reported (only if CSP is expected to block, of course) in order to avoid flakiness of the test? Also, could you avoid the variable logs and instead separate the assertions? Something like: (feel free to improve further). |
|
Thanks for the feedback @antosart. But wouldn't that relax the test, which also tests that the event is NOT always fired?
Awaiting the event would cause timeouts on failure instead of reporting said failure like the other CSP tests do.
|
|
Ah sorry. I was thinking about reports (which have a history of making tests flaky) but you are actually testing securitypolicyviolations, which should be fired deterministically (it should be enough to let the message loop run enough times). I'll take that back :) |
|
@antosart no the feedback was good. I've restructured the tests to be less timing dependent and match existing CSP tests. They now await the event with a 1 second timeout, same as logTest.js (once I understood it properly). Thanks! |
|
Aligned with upstream name tweak. Should be good to merge right after whatwg/fetch#1896. |
|
Tests merged in web-platform-tests/wpt#57217. |
|
Thanks. IIUC there is a typo in the third test case in |
For use by WebTransport and CSP: - w3c/webtransport#711 - w3c/webappsec-csp#791 Fixes #1880.
|
Hi @antosart, apologies for the late response. Yes your fix corrects the WPT to match the text... Unfortunately, I suspect it's my text that is wrong, not the WPT. I believe the WPT (before your fix) matched our intent stated in #683 (comment). I'll update the text tomorrow. Sorry for the churn on this. Thank goodness for tests, and your keen eye! |
…ault-src directive is present, not otherwise
|
Ping @antosart |
|
Sorry for the delay! The PR looks fine to me, but just to clarify: the currently specced behaviour in this PR is that
Is this correct? Is this what we want? And is that because specifying serverCertificateHashes in webtransport makes it somehow more dangerous so that an additional keyword in connect-src is needed? If so, let's add back the testcase to the WPT (I think it makes sense to keep both in |
This is correct, yes. It's not so much about dangerous, but because the way that the identification happens. The existing system operates on names, with an assumption that the Web PKI has an active role. Listing hashes is fundamentally different.
Footnotes
|
|
Thanks for the explanation! Makes sense to me. Then this PR looks fine. I went ahead and fixed the WPT in https://chromium-review.googlesource.com/c/chromium/src/+/7566522, I'll wait for that to land and then can merge this PR. |
After a conversation on w3c/webappsec-csp#791 it turns out that the behavior we are going to spec is really that any webtransport connection specifying the serverCertificateHashes is blocked by CSP unless the keyword 'unsafe-webtransport-hashes' is used. Change-Id: I473a555e6f9d61d847f415452df39731823e2d2b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7566522 Reviewed-by: Mike West <mkwst@chromium.org> Commit-Queue: Antonio Sartori <antoniosartori@chromium.org> Cr-Commit-Position: refs/heads/main@{#1583125}
After a conversation on w3c/webappsec-csp#791 it turns out that the behavior we are going to spec is really that any webtransport connection specifying the serverCertificateHashes is blocked by CSP unless the keyword 'unsafe-webtransport-hashes' is used. Change-Id: I473a555e6f9d61d847f415452df39731823e2d2b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7566522 Reviewed-by: Mike West <mkwst@chromium.org> Commit-Queue: Antonio Sartori <antoniosartori@chromium.org> Cr-Commit-Position: refs/heads/main@{#1583125}
After a conversation on w3c/webappsec-csp#791 it turns out that the behavior we are going to spec is really that any webtransport connection specifying the serverCertificateHashes is blocked by CSP unless the keyword 'unsafe-webtransport-hashes' is used. Change-Id: I473a555e6f9d61d847f415452df39731823e2d2b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7566522 Reviewed-by: Mike West <mkwst@chromium.org> Commit-Queue: Antonio Sartori <antoniosartori@chromium.org> Cr-Commit-Position: refs/heads/main@{#1583125}
|
Ok, tests are now merged. I think this is good to go! |
SHA: 1b8a543 Reason: push, by antosart Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ed.sub.https.html, a=testonly Automatic update from web-platform-tests [WPT] Fix connect-src-webtransport-allowed.sub.https.html After a conversation on w3c/webappsec-csp#791 it turns out that the behavior we are going to spec is really that any webtransport connection specifying the serverCertificateHashes is blocked by CSP unless the keyword 'unsafe-webtransport-hashes' is used. Change-Id: I473a555e6f9d61d847f415452df39731823e2d2b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7566522 Reviewed-by: Mike West <mkwst@chromium.org> Commit-Queue: Antonio Sartori <antoniosartori@chromium.org> Cr-Commit-Position: refs/heads/main@{#1583125} -- wpt-commits: ded01c9982ca18a998252cc5883e676caaef83e1 wpt-pr: 57704
Fixes #683. Assumes a
unsafe-WebTransport-hash listflagon request (seems simplest post w3c/webtransport#697).@dveditz @annevk @martinthomson WDYT?
Preview | Diff