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

Data protocol not being added to content-security-policy header #23

Closed
johnboc opened this issue Jun 18, 2018 · 3 comments
Closed

Data protocol not being added to content-security-policy header #23

johnboc opened this issue Jun 18, 2018 · 3 comments

Comments

@johnboc
Copy link

johnboc commented Jun 18, 2018

My secure-headers.php has the following rules for img-src:

'img-src' => [
            'allow' => [
                env('APP_URL') . '/',
            ],
            'types' => [
                //
            ],
            'self' => true,
            'data' => true,
        ],

However when I try to upload an image via a form as soon as the image is dropped on to the input I get the following error:

Refused to load the image 'data:image/jpeg;base64,/9j/4aI5RXhpZgAASUkqAA....//Z' because it violates the following Content Security Policy directive: "img-src 'self' http://localhost:3000/".

It appears that 'data' => true is being ignored.

@bepsvpt
Copy link
Owner

bepsvpt commented Jun 20, 2018

Hi @johnboc,

After 5.0, you should add data: in schemes. Sorry for not explaining it in document.

'img-src' => [
  'schemes' => [
    'data:',
  ],
],

@johnboc
Copy link
Author

johnboc commented Jun 20, 2018

Thanks that works.

@bepsvpt
Copy link
Owner

bepsvpt commented Jun 20, 2018

If you have any other question, feel free to open a new issue.

@bepsvpt bepsvpt closed this as completed Jun 20, 2018
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