Welcome! Log In Create A New Profile

Advanced

Re: Content Security Policy - Nginx

Sathish Kumar
June 17, 2019 08:04AM
Hi,

I tried using inline script by allowing unsafe-inline in Content Security
Policy header but am getting below error.

Refused to execute inline event handler because it violates the following
Content Security Policy directive: "script-src 'self'. Either the
'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is
required to enable inline execution.

I am able to generate sha256/nonce from code but how to validate and set in
response header in Nginx.

On Mon, Jun 10, 2019, 6:39 AM Sathish Kumar <satcse88@gmail.com> wrote:

> Hi,
>
> I would like to enable Content Security Policy header on Nginx for our
> website to protect from data injection attacks and XSS. Can I add like the
> below config?. If anybody hit our URL they will know the allowed domains in
> the header.
>
> Is there any other bettery way to do this?
>
> add_header Content-Security-Policy "default-src 'self'; script-src 'self'
> 'unsafe-inline' 'unsafe-eval' https://ssl.google-analytics.com
> https://assets.zendesk.com https://connect.facebook.net; img-src 'self'
> https://ssl.google-analytics.com https://s-static.ak.facebook.com
> https://assets.zendesk.com; style-src 'self' 'unsafe-inline'
> https://fonts.googleapis.com https://assets.zendesk.com; font-src 'self'
> https://themes.googleusercontent.com; frame-src https://assets.zendesk.com
> https://www.facebook.com https://s-static.ak.facebook.com
> https://tautt.zendesk.com; object-src 'none'";
>
>
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Content Security Policy - Nginx

Sathish Kumar June 09, 2019 06:40PM

Re: Content Security Policy - Nginx

Sathish Kumar June 17, 2019 08:04AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 302
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready