CSP guidance updates w/nonce & SRI examples #35022
Open
+254
−104
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #35017
Fixes #34351
cc: @Rick-Anderson ... You asked about this going up. I'll finish it on Monday, but the bones 🦴 are here.
Thanks @akurone @PascalVorwerk 🎸 ... Thanks for your issue and discussion. It led to a nice set of updates!
@akurone ... Could let me know what CSP you were using that resulted in the policy violation for the
ImportMap
component? For some reason, ME Edge doesn't flag it with my baseline policy. I'm not sure why, but I'd like to compare notes on that with you.Notes
ImportMap
component's rendered inline<script>
as an example, per Javier's advice.frame-ancestors
directive (to "'none'
") withContentSecurityFrameAncestorsPolicy
.'unsafe-hashes'
with a hash for the inline JS event handler inNavMenu
.I'm going to sleep on this PR over the weekend 🛌💤 and put final touches on it on Monday, and then I'll need a security review for sure on it.
NOTE TO REVIEWER
The framework seems like it's keeping it's inline JS event handler in
NavMenu
, but it seems like the interwebs security gurus and HTML spec remarks are saying to get all inline JS event handlers out. The content here is going to cover'unsafe-hashes'
with a hash for now. I opened Remove the inline JS event handler in the NavMenu component? (dotnet/aspnetcore
#61075) to ask the PU about removing it in an upcoming release.Internal previews