-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Closed
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/layout
Description
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
The style element that is created with the function createEmptyStyleRule does not have the CSP nonce when the site is serving in Chrome.
The nonce is added the following way:
mediaQueryStyleNode.nonce = nonce;
see here
But it should be done this way I think:
mediaQueryStyleNode.addAttribute('nonce', nonce);
Reproduction
StackBlitz link: https://stackblitz.com/edit/components-issue-4szyku?file=src%2Findex.html
Steps to reproduce:
- Create a new Angular project
- Add
ngCspNonce="RANDOM_CSP_NONCE_PLACEHOLDER"
to theapp-root
component in index.html - Add Angular material to the project
- Add an Material Module to the appComponent (for example: MatSlideToggleModule)
- Serve the application and open the site in Chrome
- Inspect the rendered HTML
Expected Behavior
<style type="text/css" nonce="RANDOM_CSP_NONCE_PLACEHOLDER"></style>Actual Behavior
<style type="text/css"></style>Environment
- Angular: 17.3.0
- CDK/Material: 17.3.1
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows, MacOS
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/layout