diff --git a/themes/api.jquery.com/functions.php b/themes/api.jquery.com/functions.php new file mode 100644 index 00000000..e8158237 --- /dev/null +++ b/themes/api.jquery.com/functions.php @@ -0,0 +1,8 @@ + "'self'", + 'script-src' => "'self' 'nonce-$nonce' code.jquery.com", + // The SHA is for the inline style from typesense + // 'unsafe-hashes' is required in order to use hashes in style-src + 'style-src' => "'self' 'nonce-$nonce' 'sha256-biLFinpqYMtWHmXfkA1BPeCY0/fNt46SAZ+BBk5YUog=' 'unsafe-hashes'", + // data: SVG images are used in typesense + 'img-src' => "'self' data:", + 'connect-src' => "'self' typesense.jquery.com", + 'font-src' => "'self'", + 'object-src' => "'none'", + 'media-src' => "'self'", + 'frame-src' => "'self'", + 'child-src' => "'self'", + 'form-action' => "'self'", + 'frame-ancestors' => "'none'", + 'base-uri' => "'self'", + 'block-all-mixed-content' => '', + 'report-uri' => 'https://csp-report-api.openjs-foundation.workers.dev/', + ); + + $policy = apply_filters( 'jq_content_security_policy', $policy ); + + $policy_string = ''; + foreach ( $policy as $key => $value ) { + $policy_string .= $key . ' ' . $value . '; '; + } + + header( 'Content-Security-Policy-Report-Only: ' . $policy_string ); +} diff --git a/themes/jquery/header.php b/themes/jquery/header.php index eebd91fd..2e49347a 100755 --- a/themes/jquery/header.php +++ b/themes/jquery/header.php @@ -1,3 +1,4 @@ + > @@ -5,7 +6,6 @@ <?php - global $page, $paged; wp_title( '|', true, 'right' ); bloginfo( 'name' ); $site_description = get_bloginfo( 'description', 'display' );