Problem:
In RHDH, opening file preview modal throws a Content security policy error to include https://cdn.jsdelivr.net in csp rules, which is problematic as overriding csp rules unfortunately breaks other areas of the backstage application and forces us to include unsafe-eval values which is not safe as per security standards.
As a workaround, we had to add the following config:
csp:
script-src:
- "'self'"
- "'unsafe-eval'" # this is required for scaffolder usage, and ajv validation.
- https://cdn.jsdelivr.net # this is required for react-code-editor.
Our goal is to remove the script-src rules entirely, and If we remove the script-src rules, then the scaffolder plugin works as expected but react-code-editor (monaco-editor in file preview modal) doesn't work.
Proposal:
PF chatbot to include the monaco-editor as npm package rather than loading it via default cdn way.
cc: @rebeccaalpert