Skip to content

Commit

Permalink
Update CSP to support FAST
Browse files Browse the repository at this point in the history
  • Loading branch information
rajsite committed Mar 4, 2024
1 parent 249c8ef commit 31b7fd0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion angular-workspace/projects/example-client-app/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ module.exports = function (config) {
// Need script-src 'unsafe-inline' to support karma behavior
// See https://github.com/karma-runner/karma/issues/3260
// Need script-src 'unsafe-eval' to support running in Angular tests
// Need style-src 'unsafe-inline' to support FAST
// See: https://github.com/microsoft/fast/issues/4510
// Need worker-src blob: to support current worker loading pattern
{
match: '\\.html',
name: 'Content-Security-Policy',
value: "default-src 'self'; frame-ancestors 'self'; form-action 'self'; object-src 'none'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; worker-src 'self' blob: ;"
value: "default-src 'self'; frame-ancestors 'self'; form-action 'self'; object-src 'none'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; worker-src 'self' blob: ;"
}
]
});
Expand Down
4 changes: 3 additions & 1 deletion angular-workspace/projects/ni/nimble-angular/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ module.exports = config => {
// Need script-src 'unsafe-inline' to support karma behavior
// See https://github.com/karma-runner/karma/issues/3260
// Need script-src 'unsafe-eval' to support running in Angular tests
// Need style-src 'unsafe-inline' to support FAST
// See: https://github.com/microsoft/fast/issues/4510
// Need worker-src blob: to support current worker loading pattern
{
match: '\\.html',
name: 'Content-Security-Policy',
value: "default-src 'self'; frame-ancestors 'self'; form-action 'self'; object-src 'none'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; worker-src 'self' blob: ;"
value: "default-src 'self'; frame-ancestors 'self'; form-action 'self'; object-src 'none'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; worker-src 'self' blob: ;"
}
]
});
Expand Down
6 changes: 4 additions & 2 deletions packages/nimble-components/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,14 @@ module.exports = config => {
// Test under the OWASP Basic non-strict CSP Policy
// See: https://cheatsheetseries.owasp.org/cheatsheets/Content_Security_Policy_Cheat_Sheet.html#basic-non-strict-csp-policy
// Need script-src 'unsafe-inline' to support karma behavior
// See https://github.com/karma-runner/karma/issues/3260
// See: https://github.com/karma-runner/karma/issues/3260
// Need style-src 'unsafe-inline' to support FAST
// See: https://github.com/microsoft/fast/issues/4510
// Need worker-src blob: to support current worker loading pattern
{
match: '\\.html',
name: 'Content-Security-Policy',
value: "default-src 'self'; frame-ancestors 'self'; form-action 'self'; object-src 'none'; script-src 'self' 'unsafe-inline'; worker-src 'self' blob: ;"
value: "default-src 'self'; frame-ancestors 'self'; form-action 'self'; object-src 'none'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; worker-src 'self' blob: ;"
}
]
};
Expand Down

0 comments on commit 31b7fd0

Please sign in to comment.