admin管理员组

文章数量:1134248

I have a Content-Security-Policy for my Wordpress Website (LAMP-Server):

set Content-Security-Policy "base-uri 'self'; default-src 'self'; font-src 'self' data: ; frame-src ; img-src 'self' ; script-src 'self' 'unsafe-inline' ; style-src 'self' 'unsafe-inline' ; object-src 'self'; form-action 'self'; frame-ancestors 'self';"

This CSP prevents me from activating any check box in Wordpress (either the check box that remembers my login or the check boxes that let me select which theme to update) (Tested with Firefox in Linux and Chrome on Android).

Without CSP everything works as expected.

Any hint on which CSP is required to make that work again is greatly appreciated.

I have a Content-Security-Policy for my Wordpress Website (LAMP-Server):

set Content-Security-Policy "base-uri 'self'; default-src 'self'; font-src 'self' data: https://fonts.gstatic.com; frame-src https://www.google.com https://www.youtube.com; img-src 'self' https://secure.gravatar.com; script-src 'self' 'unsafe-inline' ; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; object-src 'self'; form-action 'self'; frame-ancestors 'self';"

This CSP prevents me from activating any check box in Wordpress (either the check box that remembers my login or the check boxes that let me select which theme to update) (Tested with Firefox in Linux and Chrome on Android).

Without CSP everything works as expected.

Any hint on which CSP is required to make that work again is greatly appreciated.

Share Improve this question asked Jan 23, 2022 at 11:00 UmbertonesUmbertones 112 bronze badges 2
  • 1 There’s no reason a CSP should stop checkboxes from working. The likely cause is a broken script. You should check the console for errors. – Jacob Peattie Commented Jan 23, 2022 at 12:41
  • Thanks for the hint with the console. Content Security Policy: Die Einstellungen der Seite haben das Laden einer Ressource auf data:image/svg+xml;utf8,%3Csvg%20xmlns%3… blockiert ("img-src"). In img src self is allowed..what am I missing here – Umbertones Commented Jan 23, 2022 at 19:27
Add a comment  | 

1 Answer 1

Reset to default 1

Thanks to Jacob's hint I got the solution. This one is working.

Header set Content-Security-Policy "base-uri 'self'; default-src 'self'; font-src 'self' data: https://fonts.gstatic.com; frame-src https://www.google.com https://www.youtube.com; img-src data: 'self' https://secure.gravatar.com; script-src 'self' 'unsafe-inline' ; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; object-src 'self'; form-action 'self'; frame-ancestors 'self';"

The difference is the data: in the ìmg-src section.

本文标签: ContentSecurityPolicy blocks Wordpress check boxes from being activated