Skip to content
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

JavaScript error: EvalError: call to Function() blocked by CSP #23928

Closed
GhaziTriki opened this issue Apr 4, 2023 · 7 comments
Closed

JavaScript error: EvalError: call to Function() blocked by CSP #23928

GhaziTriki opened this issue Apr 4, 2023 · 7 comments
Labels
topic/ui Change the appearance of the Gitea UI type/bug

Comments

@GhaziTriki
Copy link

Description

I am running gitea behind nginx revers proxy. In the UI get the following JS error message that prevents me from doing some actions like switching to SSH.

JavaScript error: EvalError: call to Function() blocked by CSP (https://gitea.mycompany.net/assets/js/index.js?v=1.19.0 @ 19:71859). Open browser console to see more details.

In the console I have 'Content Security Policy: The page’s settings blocked the loading of a resource at eval (“default-src”).'

Screenshots

2023-04-04_20-51

Gitea Version

1.19.0

Can you reproduce the bug on the Gitea demo site?

Yes

Operating System

Ubuntu 20.04 LTS

Browser Version

Firefox 111.0.1 (64-bit)

@GhaziTriki GhaziTriki added type/bug topic/ui Change the appearance of the Gitea UI labels Apr 4, 2023
@silverwind
Copy link
Member

silverwind commented Apr 4, 2023

It's likely because of the Vue template compiler which requires unsafe-eval CSP. See #19851 and linked discussions. We need to find out how to remove it from served JS.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Apr 5, 2023

I think it has been fixed in 1.20 (the latest main dev branch), there is no EvalError anymore.

Welcome to try.

@wxiaoguang
Copy link
Contributor

Do you still have problem in 1.20? (I guess there won't be problem, I had tested the CSP when I did the refactoring)

That was a big refactoring, so the changes were not backported to 1.19

@GhaziTriki

This comment was marked as resolved.

@techknowlogick

This comment was marked as resolved.

@GhaziTriki
Copy link
Author

I confirm it works in 1.20 build from "main"

@techknowlogick
Copy link
Member

@GhaziTriki fantastic! I'll close this ticket now :)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/ui Change the appearance of the Gitea UI type/bug
Projects
None yet
Development

No branches or pull requests

4 participants