backend-common: reintroduce unsafe-eval

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-01-03 11:06:22 +01:00
parent 1fa18f2ab6
commit eacc582473
2 changed files with 9 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/backend-common': patch
---
Reverted the default CSP configuration to include `'unsafe-eval'` again, which was mistakenly removed in the previous version.
@@ -228,6 +228,10 @@ export function applyCspDirectives(
const result: ContentSecurityPolicyOptions['directives'] =
helmet.contentSecurityPolicy.getDefaultDirectives();
// TODO(Rugvip): We currently use non-precompiled AJV for validation in the frontend, which uses eval.
// It should be replaced by any other solution that doesn't require unsafe-eval.
result['script-src'] = ["'self'", "'unsafe-eval'"];
if (directives) {
for (const [key, value] of Object.entries(directives)) {
if (value === false) {