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

New script src directives #200

Open
ooOsH opened this issue Apr 3, 2019 · 1 comment
Open

New script src directives #200

ooOsH opened this issue Apr 3, 2019 · 1 comment

Comments

@ooOsH
Copy link

ooOsH commented Apr 3, 2019

Will you be adding support for the more granular script src directives script-src-attr, script-src-elem, style-src-attr, style-src-elem ?

@ndench
Copy link

ndench commented May 4, 2020

For anyone else who comes across this because their CSP is currently broken in Chrome. The latest release of Symfony (3.4.401, 4.4.8 and 5.0.8), the WebProfilerBundle adds the script-src-elem and style-src-elem directives if they don't already exist. So if you have

    csp:
        enforce:
            default-src: ['none']
            # ...

It will copy default-src: 'none' into the *-elem directives, causing chrome to ignore the script-src and style-src directives and most likely cause all your styles and scripts to not load. This has been reported in symfony/symfony#36643 and symfony/symfony#36641.

As a quick workaround for now, you add add the following to packages/dev/nelmio_security.yaml which will cause the WebProfilerBundle to not add the directives:

    csp:
        enforce:
+            default-src: ['unsafe-inline']

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

No branches or pull requests

2 participants