Repository navigation
fix(@angular/build): add CSP nonce to stylesheet and modulepreload link elements - #34256
Open
alan-agius4 wants to merge 1 commit into
Open
alan-agius4 wants to merge 1 commit into
alan-agius4 wants to merge 1 commit into
Conversation
alan-agius4
force-pushed
the
feat-link-nonce
branch
from
October 5, 2026 15:24
24e40c2 to
de11568
Compare
There was a problem hiding this comment.
Code Review
This pull request updates the addNonce utility to add nonce expressions to stylesheet and modulepreload <link> tags, and includes tests to verify this behavior as well as the retention of nonces during critical CSS inlining. The feedback suggests converting the rel attribute value to lowercase before tokenizing to ensure case-insensitive matching for values like stylesheet and modulepreload.
…nk elements Under strict Content Security Policies that do not allow 'self' in style-src or style-src-elem, external stylesheets must be authorized via a cryptographic nonce. This commit updates addNonce to apply the CSP nonce to <link> elements with rel containing 'stylesheet' or 'modulepreload'. Closes angular#34255
alan-agius4
force-pushed
the
feat-link-nonce
branch
from
October 5, 2026 16:35
5baadce to
bb10239
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Under strict Content Security Policies that do not include 'self' in
style-srcorstyle-src-elem, external stylesheets must be authorized via a cryptographic nonce.This PR updates
addNonceto also apply the CSP nonce to<link>elements whoserelcontainsstylesheetormodulepreload.Closes #34255