Skip to content

Commit bcef8cb

Browse files
committed
jquery: Allow style-src-attr in CSP
Restore rendering of blog posts such as https://blog.jquerymobile.com/2011/06/14/jquery-mobile-update-week-of-june-13/ which in older posts often use style attributes to float an image, or create some ad-hoc design element. Compare to https://web.archive.org/web/20230602085906/https://blog.jquerymobile.com/2011/06/14/jquery-mobile-update-week-of-june-13/ Follows-up CSP work from last year at jquery/infrastructure-puppet#54, although this is only an issue as of today, since I am migrating blog.jquerymobile.com from the legacy blog theme to jquery-wp-content. It did not affect blog.jquery.com and blog.jqueryui.com, since those haven't migrated yet. Ref jquery/infrastructure-puppet#17
1 parent 0d9c44f commit bcef8cb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

themes/jquery/functions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ function jq_content_security_policy() {
263263
'script-src' => "'self' 'nonce-$nonce' code.jquery.com",
264264
// The nonce is here so inline scripts can be used in the theme
265265
'style-src' => "'self' 'nonce-$nonce' code.jquery.com",
266+
// Allow style="" attributes in blog posts and markdown.
267+
'style-src-attr' => "'unsafe-inline'",
266268
// data: SVG images are used in typesense
267269
// Allow gravatars in wordpress admins
268270
'img-src' => "'self' data: secure.gravatar.com code.jquery.com",

0 commit comments

Comments
 (0)