CSP error after upgrading from Angular 11 to 12
imsergiobernal opened this issue · 2 comments
I dont know if I did something more but this was the main thing I have done.
It seems that now Google Chrome requests me to put a hash into the scripts files but, they are imported from angular.json:scripts|styles[].
Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution. Note that hashes do not apply to event handlers, style attributes and javascript: navigations unless the 'unsafe-hashes' keyword is present.
@imsergiobernal
Hi from Turkia;
I get same error in my project. How can i fix the error.
thanks you
"private": true,
"dependencies": {
"@angular/animations": "^12.2.9",
"@angular/common": "^12.2.9",
"@angular/compiler": "^12.2.9",
"@angular/core": "^12.2.9",
"@angular/forms": "^12.2.9",
"@angular/platform-browser": "^12.2.9",
"@angular/platform-browser-dynamic": "^12.2.9",
"@angular/router": "^12.2.9",
"primeicons": "^4.1.0",
"primeng": "^12.2.0",
"rxjs": "~6.6.7",
"tslib": "^2.3.1",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~12.2.9",
"@angular/cli": "^12.2.9",
"@angular/compiler-cli": "^12.2.9",
"@angular/language-service": "^12.2.9",
"@types/chrome": "0.0.141",
"@types/node": "^16.10.3",
"awesome-typescript-loader": "^5.2.1",
"bestzip": "^2.1.7",
"codelyzer": "^6.0.0",
"ngx-build-plus": "^12.0.1",
"npm-run-all": "^4.1.5",
"rimraf": "^2.7.1",
"ts-node": "~10.2.1",
"typescript": "~4.3.5",
"webpack": "^4.42.1",
"webpack-cli": "^4.8.0"
}