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

CSP exceptions #63

Merged
merged 1 commit into from
Oct 20, 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
10 changes: 9 additions & 1 deletion modules/profile/templates/contentorigin/site.nginx.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ server {

# Add Content Security Policy headers
add_header Reporting-Endpoints "csp-endpoint='https://csp-report-api.openjs-foundation.workers.dev/'";
add_header Content-Security-Policy-Report-Only "default-src 'self'; script-src 'self' code.jquery.com; connect-src 'self'; img-src 'self'; style-src 'self'; report-uri https://csp-report-api.openjs-foundation.workers.dev/; report-to csp-endpoint";
add_header Content-Security-Policy-Report-Only "
default-src 'self';
script-src 'self' code.jquery.com;
connect-src 'self';
img-src 'self';
style-src 'self';
report-uri https://csp-report-api.openjs-foundation.workers.dev/;
report-to csp-endpoint
";

location / {
root /srv/www/content.jquery.com;
Expand Down
12 changes: 11 additions & 1 deletion modules/profile/templates/gruntjscom/site.nginx.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ server {

# Add Content Security Policy headers
add_header Reporting-Endpoints "csp-endpoint='https://csp-report-api.openjs-foundation.workers.dev/'";
add_header Content-Security-Policy-Report-Only "default-src 'self'; script-src 'self'; connect-src 'self'; img-src 'self'; style-src 'self'; report-uri https://csp-report-api.openjs-foundation.workers.dev/; report-to csp-endpoint;" always;
# script-src: add 'unsafe-eval' for the search functionality on gruntjs.com/plugins
# Search will need to be reimplemented to remove this exception.
add_header Content-Security-Policy-Report-Only "
default-src 'self';
script-src 'self' 'unsafe-eval';
connect-src 'self';
img-src 'self';
style-src 'self';
report-uri https://csp-report-api.openjs-foundation.workers.dev/;
report-to csp-endpoint
" always;
}

location /.well-known/acme-challenge {
Expand Down
15 changes: 14 additions & 1 deletion modules/profile/templates/miscweb/site.nginx.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,20 @@ server {

# Add Content Security Policy headers
add_header Reporting-Endpoints "csp-endpoint='https://csp-report-api.openjs-foundation.workers.dev/'";
add_header Content-Security-Policy-Report-Only "default-src 'self'; script-src 'self' code.jquery.com; connect-src 'self'; img-src 'self'; style-src 'self'; report-uri https://csp-report-api.openjs-foundation.workers.dev/; report-to csp-endpoint";
# script-src: add 'wasm-unsafe-eval' for WebAssembly-driven search on
# bugs.jquery.com, bugs.jqueryui.com, and plugins.jquery.com
# img-src: allow secure.gravatar.com images on plugins.jquery.com
# media-src: allow content.jquery.com media on podcast.jquery.com
add_header Content-Security-Policy-Report-Only "
default-src 'self';
script-src 'self' 'wasm-unsafe-eval' code.jquery.com;
connect-src 'self';
img-src 'self' secure.gravatar.com;
style-src 'self';
media-src 'self' content.jquery.com;
report-uri https://csp-report-api.openjs-foundation.workers.dev/;
report-to csp-endpoint
";

<%- if @site['allow_php'] -%>
index index.php index.html;
Expand Down