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

All: enable CSP report header on production sites #473

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions plugins/jquery-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@
return 1024 * 1024;
} );

// Disable the new image sizes feature.
// It adds a style tag that would require a CSP exception.
add_filter( 'wp_img_tag_add_auto_sizes', '__return_false' );

// Allow full HTML in term descriptions.
add_action( 'init', 'jquery_unfiltered_html_for_term_descriptions' );
add_action( 'set_current_user', 'jquery_unfiltered_html_for_term_descriptions' );
Expand Down
2 changes: 1 addition & 1 deletion themes/contribute.jquery.org/functions.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

// Allow loading a Vimeo video on
// https://local.contribute.jquery.org/markup-conventions/
// https://contribute.jquery.org/markup-conventions/
add_filter( 'jq_content_security_policy', function ( $policy ) {
$policy[ 'frame-src' ] = "'self' player.vimeo.com";
return $policy;
Expand Down
3 changes: 0 additions & 3 deletions themes/jquery/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,6 @@ function jq_image_posted_on() {
* Content Security Policy
*/
function jq_content_security_policy() {
if ( !JQUERY_STAGING ) {
return;
}
$nonce = bin2hex( random_bytes( 8 ) );
$report_url = 'https://csp-report-api.openjs-foundation.workers.dev/';
$policy = array(
Expand Down
Loading