-
Notifications
You must be signed in to change notification settings - Fork 0
Integrating hash reporting into CSP #4
Comments
Thanks for filing this!
Oh, I didn't think of I'd love @mikewest's opinions of the above. |
Yeah, I think it would be quite reasonable to make this an opt-in feature (via a |
A number of folks at Google (including @mikewest, @camillelamy, @aaj, @lweichselbaum) met up last week to brainstorm future plans around CSP and we're quite excited about some potential new improvements to CSP, especially around hashes. Concretely, we're thinking about picking up the work on URL hashes and eval hashes which will both be big steps towards making hash-based CSPs easier to adopt. Given that, we're also generally in favor of trying to fit this feature into CSP (even if it is a separate type of report dispatched at a separate time) since it will fit in well with the effort to make hash-based CSPs more practical to adopt. @yoavweiss if we're on board with this plan, does this approach seem like it could solve your use cases? |
@ddworken Well I'm flattered but I don't work at google. Did you mean @Jaredk3nt? |
A friend of mine has spent an unreasonable amount of time just trying to figure out who you've confused me with, based on the typo alone. WE NEED TO KNOW! |
Ah, I'm sorry about the mistaken tag! @arturjanc is who I meant to tag. :) |
I like this idea and see a lot of value in including hashes in violation reports (for both inline scripts and script#src attributes, and contents of external script resources, wherever that's allowed by the SOP or presence of CORS). It's not exactly the same, but we also have w3c/webappsec-csp#575 which suggested |
Also, nice to meet you @aaj, please consider yourself an honorary Googler based on the callout in this thread :) |
Given the consensus and since this seems a relatively small addition to the |
Thanks for filing this. I'm replacing this proposal with a CSP PR: w3c/webappsec-csp#693 |
I'm wondering: Would it be feasible to have this be a part of CSP, rather than a standalone proposal? While I know generally we are hesitant to shove more things into CSP, I actually think there could be quite a bit of value in integrating this into CSP since it would unlock a new use case for this: Deploying a hash-based CSP. Currently it is rather difficult for sites to deploy hash-based CSPs since it requires that they manually calculate the hashes of all JS. If we could have CSP reports include hashes, this would make it trivial to use report-only mode to calculate a CSP header for any application, which has the potential to greatly ease adoption of CSP.
Replying to some of the points made in the explainer:
I think it would be reasonable if we limited hash reporting to report-only mode, since there is probably much less utility to knowing the hash when in enforcing mode. And for report-only mode, I wonder: Would it be possible to defer sending reports until response time? Or alternatively, could CSP introduce a new report type for this that is sent at response-time? Either of these options seem like they would work for both potential uses for this feature.
Since CSP allows setting multiple independent policies that are independently evaluated, this shouldn't be an issue. A website could easily set two distinct CSP policies:
Where the first one would mitigate XSS and the second one would collect script hashes.
So overall, I suspect that putting this in CSP might increase utility at the cost of a little extra complexity in CSP.
The text was updated successfully, but these errors were encountered: