angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Content Security Policy: script-src without 'unsafe-inline' impacts rendering

Open school-coder opened this issue 5 years ago • 2 comments

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

No

Description

I have content security policy header defined as,

default-src 'self'; img-src * 'self' data:; object-src 'none'; child-src * mailto: tel: ms-word:; script-src 'self' 'nonce-loader'; style-src 'self' 'unsafe-inline'; form-action 'self' ; frame-ancestors 'self';

I dont have unsafe-inline for script-src

In app.component.html,

<h2>Test</h2>

In styles.css

h2 { color: green }

Deployed the application in the tomcat server.

Impact: CSS rules defined in default styles.css is not rendered in the browser.

In the browser console, following error log found,

image

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in

Angular CLI: 12.0.0
Node Version: 14.15.0

Anything else?

Does unsafe-inline for script-src is mandatory for an angular application?

school-coder avatar Aug 03 '21 14:08 school-coder

Duplicate of https://github.com/angular/angular-cli/issues/20864

alan-agius4 avatar Aug 03 '21 16:08 alan-agius4

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.