Skip to content

Commit 1a47589

Browse files
authored
All: enable CSP report header on production sites
- disable style tag added in WordPress 6.7 Ref jquery/infrastructure-puppet#54 Closes gh-473
1 parent 946b251 commit 1a47589

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

plugins/jquery-filters.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@
8888
return 1024 * 1024;
8989
} );
9090

91+
// Disable the new image sizes feature.
92+
// It adds a style tag that would require a CSP exception.
93+
add_filter( 'wp_img_tag_add_auto_sizes', '__return_false' );
94+
9195
// Allow full HTML in term descriptions.
9296
add_action( 'init', 'jquery_unfiltered_html_for_term_descriptions' );
9397
add_action( 'set_current_user', 'jquery_unfiltered_html_for_term_descriptions' );

themes/contribute.jquery.org/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
// Allow loading a Vimeo video on
4-
// https://local.contribute.jquery.org/markup-conventions/
4+
// https://contribute.jquery.org/markup-conventions/
55
add_filter( 'jq_content_security_policy', function ( $policy ) {
66
$policy[ 'frame-src' ] = "'self' player.vimeo.com";
77
return $policy;

themes/jquery/functions.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,6 @@ function jq_image_posted_on() {
256256
* Content Security Policy
257257
*/
258258
function jq_content_security_policy() {
259-
if ( !JQUERY_STAGING ) {
260-
return;
261-
}
262259
$nonce = bin2hex( random_bytes( 8 ) );
263260
$report_url = 'https://csp-report-api.openjs-foundation.workers.dev/';
264261
$policy = array(

0 commit comments

Comments
 (0)