Skip to content

Content Security Policy of your site blocks the use of 'eval' in JavaScript #2550

Closed

Description

@jnweiger

Initial Checklist

  • I understand this is a bug report and questions should be posted in the Community Discussions
  • I searched issues and couldn’t find anything (or linked relevant results below)

Bug Description

oc-6.2.0 started at hetzner cloud via docker compose according to https://docs.opencloud.eu/docs/admin/getting-started/container/docker-compose/docker-compose-base/
Browser: Firefox 150.0.2 Ubuntu 24.04
Browser: Chromium 147.0.7727.137 openSUSE 15.6

The Content Security Policy (CSP) prevents the evaluation of arbitrary strings as JavaScript to make it more difficult for an attacker to inject unathorized code on your site.

Chromium shows:

Source location Directive Status
zod-B9_iiKzJ.mjs:1 script-src blocked
src-CIfRBuLG.mjs:770 script-src blocked

Firefox shows:

Content-Security-Policy: The page’s settings blocked a JavaScript eval (script-src) from being executed because it violates the following directive: “script-src 'self' 'unsafe-inline' https://keycloak.opencloud.test/” (Missing 'unsafe-eval') zod-B9_iiKzJ.mjs:1:4622
Content-Security-Policy: The page’s settings blocked a JavaScript eval (script-src) from being executed because it violates the following directive: “script-src 'self' 'unsafe-inline' https://keycloak.opencloud.test/” (Missing 'unsafe-eval') src-CIfRBuLG.mjs:770:47555
OpenCloud Web UI 7.0.0

Note, that according to documentation I've set:

grep KEYCLOAK_DOMAIN .env
KEYCLOAK_DOMAIN=keycloak.oc62a.jwqa.de

But there seem to be more variables that default to keycloak.opencloud.test :

grep -R keycloak.opencloud.test | grep -v KEYCLOAK_DOMAIN
config/opencloud/csp.yaml: - 'https://${IDP_DOMAIN|keycloak.opencloud.test}${TRAEFIK_PORT_HTTPS}/'
config/opencloud/csp.yaml: - 'https://${IDP_DOMAIN|keycloak.opencloud.test}${TRAEFIK_PORT_HTTPS}/'
idm/external-idp.yml: OC_OIDC_ISSUER: ${IDP_ISSUER_URL:-https://keycloak.opencloud.test/realms/openCloud}
idm/external-idp.yml: IDP_DOMAIN: ${IDP_DOMAIN:-keycloak.opencloud.test}

Reproduction Steps

login at the website

Expected Outcome

  • no CSP errors.

  • only one variable should be used to specify the DNS name of the IDP.

Actual Outcome

Warnings.
An admin may need to workaround by finding variables that don't appear in the install instructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions