Skip to content

fix(site): Fix CSP directives for monaco #6709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2023
Merged

Conversation

BrunoQuaresma
Copy link
Collaborator

Closes #6590

@BrunoQuaresma BrunoQuaresma requested a review from a team March 21, 2023 19:37
@BrunoQuaresma BrunoQuaresma self-assigned this Mar 21, 2023
@BrunoQuaresma BrunoQuaresma requested review from Kira-Pilot and removed request for a team March 21, 2023 19:37
@BrunoQuaresma BrunoQuaresma enabled auto-merge (squash) March 21, 2023 19:45
@BrunoQuaresma BrunoQuaresma requested a review from a team March 21, 2023 19:45
@BrunoQuaresma BrunoQuaresma merged commit 5cbe360 into main Mar 21, 2023
@BrunoQuaresma BrunoQuaresma deleted the bq/monaco-local branch March 21, 2023 19:51
@github-actions github-actions bot locked and limited conversation to collaborators Mar 21, 2023
@@ -326,7 +326,8 @@ func cspHeaders(next http.Handler) http.Handler {
CSPDirectiveScriptSrc: {"'self' https://cdn.jsdelivr.net"},
CSPDirectiveStyleSrc: {"'self' 'unsafe-inline' https://cdn.jsdelivr.net"},
// data: is used by monaco editor on FE for Syntax Highlight
CSPDirectiveFontSrc: {"'self' data:"},
CSPDirectiveFontSrc: {"'self' https://cdn.jsdelivr.net data:"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @Emyrk

@BrunoQuaresma we can't import external assets like this, because we're self-hosted customers might be airgapped.

Copy link
Collaborator Author

@BrunoQuaresma BrunoQuaresma Mar 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm aware of it. Since we are already doing it I added it as a quick fix. In the past, I tried to make Monaco editor work with local file but it didn't work. I will give it a try again during the week. If we are not able to get this working, we may need a plan.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, I see! That's helpful context.

Customers will likely see this come up in security scans, because I believe users can host anything on jsdelivr, so an XSS attack becomes possible with this in product.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know about jsdeliver. We can match specific files, eg:

https://cdn.jsdelivr.net/the/file/we/want

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally agree. I think would be very hard to track files individually.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

template editor: some editor icons do not show up
4 participants