Skip to content

Commit

Permalink
nginx: remove new lines from csp headers
Browse files Browse the repository at this point in the history
  • Loading branch information
timmywil committed Nov 16, 2024
1 parent cc72233 commit af18907
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 31 deletions.
10 changes: 1 addition & 9 deletions modules/profile/templates/contentorigin/site.nginx.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,7 @@ 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
10 changes: 1 addition & 9 deletions modules/profile/templates/gruntjscom/site.nginx.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,7 @@ server {
add_header Reporting-Endpoints "csp-endpoint='https://csp-report-api.openjs-foundation.workers.dev/'";
# 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;
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: 2 additions & 13 deletions modules/profile/templates/miscweb/site.nginx.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,13 @@ server {
# Add Content Security Policy headers
add_header Reporting-Endpoints "csp-endpoint='https://csp-report-api.openjs-foundation.workers.dev/'";
<%- if @site['csp_header'] -%>
add_header Content-Security-Policy-Report-Only "
<%= @site['csp_header'] %>
";
add_header Content-Security-Policy-Report-Only "<%= @site['csp_header'] %>";
<%- else -%>
# 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
";
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";
<%- end -%>

<%- if @site['allow_php'] -%>
Expand Down

0 comments on commit af18907

Please sign in to comment.