Skip to content
This repository was archived by the owner on Nov 9, 2023. It is now read-only.

Commit 6a61a28

Browse files
committed
Harden devconsole content security policy
The changes to angular.json are to disable inline critical CSS, which breaks without "script-src 'unsafe-inline'" (which we obviously don't want to have). See angular/angular-cli#20864 for details.
1 parent ae5b71a commit 6a61a28

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

ansible/nginx/devconsole.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ http {
7979
root /srv/staging.dev.accrescent.app;
8080

8181
include security.conf;
82-
add_header Content-Security-Policy "trusted-types angular; require-trusted-types-for 'script';" always;
82+
add_header Content-Security-Policy "default-src 'self'; font-src https://fonts.gstatic.com; style-src 'self' 'unsafe-inline'; frame-ancestors 'none'; sandbox allow-downloads allow-forms allow-same-origin allow-scripts; base-uri 'self'; trusted-types angular; require-trusted-types-for 'script';" always;
8383

8484
gzip_static on;
8585

web/angular.json

+8
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@
4848
"with": "src/environments/environment.prod.ts"
4949
}
5050
],
51+
"optimization": {
52+
"scripts": true,
53+
"styles": {
54+
"minify": true,
55+
"inlineCritical": false
56+
},
57+
"fonts": true
58+
},
5159
"outputHashing": "all"
5260
},
5361
"development": {

0 commit comments

Comments
 (0)