Skip to content

Commit

Permalink
test: enable Content Security Policy (CSP) to test the scion-toolkit …
Browse files Browse the repository at this point in the history
…is CSP compliant

The browser will prevent the toolkit testing app from loading if the scion-toolkit or any dependencies violate the CSP policy.
  • Loading branch information
Marcarrian authored and danielwiehl committed Nov 1, 2024
1 parent f1e6909 commit 27198c1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
10 changes: 8 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,10 @@
"buildTarget": "components-app:build:production"
},
"development": {
"buildTarget": "components-app:build:development"
"buildTarget": "components-app:build:development",
"headers": {
"Content-Security-Policy": "default-src 'self'; connect-src 'self' blob: localhost:*; font-src 'self' https://fonts.gstatic.com; style-src 'self' https://fonts.googleapis.com 'nonce-STATIC_NONCE'; script-src 'self' 'nonce-STATIC_NONCE';"
}
}
},
"defaultConfiguration": "development"
Expand Down Expand Up @@ -321,7 +324,10 @@
"buildTarget": "components-testing-app:build:production"
},
"development": {
"buildTarget": "components-testing-app:build:development"
"buildTarget": "components-testing-app:build:development",
"headers": {
"Content-Security-Policy": "default-src 'self'; connect-src 'self' blob: localhost:*; font-src 'self' https://fonts.gstatic.com; style-src 'self' https://fonts.googleapis.com 'nonce-STATIC_NONCE'; script-src 'self' 'nonce-STATIC_NONCE';"
}
}
},
"defaultConfiguration": "development"
Expand Down
2 changes: 1 addition & 1 deletion apps/components-testing-app/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<app-root></app-root>
<app-root ngCspNonce="STATIC_NONCE"></app-root>
</body>
</html>
9 changes: 9 additions & 0 deletions apps/components-testing-app/vercel-test-server.config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"headers": [
{
"source": "**",
"headers": [
{
"key": "Content-Security-Policy",
"value": "default-src 'self'; connect-src 'self' blob: localhost:*; font-src 'self' https://fonts.gstatic.com; style-src 'self' https://fonts.googleapis.com 'nonce-STATIC_NONCE'; script-src 'self' 'nonce-STATIC_NONCE';"
}
]
},
{
"source": "**",
"headers": [
Expand Down
2 changes: 1 addition & 1 deletion apps/components/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
<app-root ngCspNonce="STATIC_NONCE"></app-root>
</body>
</html>

0 comments on commit 27198c1

Please sign in to comment.