Skip to content

react-code-editor uses cdn to load monaco-editor by default which is not allowed in RHDH #742

@karthikjeeyar

Description

@karthikjeeyar

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.

Image

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

Metadata

Metadata

Assignees

Labels

PF6Applies to only the PF6 version

Type

Projects

Status

PR Review

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions