Skip to content

Commit f218d6b

Browse files
committed
Nginx: switch the default CSP mode to report-only for now
1 parent bb7405a commit f218d6b

File tree

17 files changed

+19
-19
lines changed

17 files changed

+19
-19
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Images with `nginx` can be configured using the following environment variables.
2222
### Content Security Policy
2323

2424
You can control the CSP behaviour with the `NGINX_CSP_MODE` key:
25-
- `enforce` (default): Configure the `Content-Security-Policy` header.
26-
- `report-only`: Instead configure the `Content-Security-Policy-Report-Only` header.
25+
- `enforce`: Configure the `Content-Security-Policy` header.
26+
- `report-only` (default): Instead configure the `Content-Security-Policy-Report-Only` header.
2727

2828
Note: the following fetch & navigation CSP keys can also be set via an embedded file located at `/etc/csp-generator/default`.
2929

common/scripts/startup/50-env-configure-nginx-csp.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ set -euo pipefail
1414
# `NGINX_CSP_…`, like `NGINX_CSP_CHILD_SRC`.
1515
#
1616
# Inputs (aside from all the individual CSP settings):
17-
# - NGINX_CSP_MODE: defaults to 'enforce'
17+
# - NGINX_CSP_MODE: defaults to 'report-only'
1818
# - NGINX_CSP_REPORT_URI: defaults to ''
1919
# - NGINX_FRAME_OPTIONS: defaults to 'deny', note that setting to `disable` removes the header completely.
2020

2121
# Set defaults
2222
NGINX_CONFIG_FILE='/etc/nginx/snippets/vars/csp-and-robots.conf'
2323
NGINX_CSP_ITEMS='child-src connect-src font-src form-action frame-ancestors frame-src img-src manifest-src media-src object-src require-trusted-types-for script-src style-src trusted-types worker-src'
24-
NGINX_CSP_MODE="${NGINX_CSP_MODE:-enforce}"
24+
NGINX_CSP_MODE="${NGINX_CSP_MODE:-report-only}"
2525
NGINX_CSP_REPORT_URI="${NGINX_CSP_REPORT_URI:-}"
2626
NGINX_FRAME_OPTIONS="${NGINX_FRAME_OPTIONS:-deny}"
2727

tests/nuxt-base/final/csp/env.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ NGINX_CSP_STYLE_SRC="https://styles.environment.com data: 'unsafe-inline'"
1414
NGINX_CSP_TRUSTED_TYPES="environment-foo env-bar"
1515
NGINX_CSP_WORKER_SRC="https://workers.environment.com data:"
1616

17-
NGINX_CSP_MODE=report-only
17+
NGINX_CSP_MODE=enforce
1818
NGINX_CSP_REPORT_URI=https://sentry.appwi.se/api/347/security/?sentry_key=foo123
1919
NGINX_FRAME_OPTIONS=sameorigin

tests/nuxt-base/final/csp/goss.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ http:
33
check envs and secrets:
44
headers:
55
- >-
6-
Content-Security-Policy-Report-Only:
6+
Content-Security-Policy:
77
default-src 'self';
88
child-src https://children.embedded.com 'self' https://children.environment.com data:;
99
connect-src https://connection.embedded.com 'self' https://connection.environment.com data:;

tests/nuxt-base/final/default/goss.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ http:
55
body:
66
- 'Hey from index.mjs'
77
headers:
8-
- 'Content-Security-Policy: default-src ''self'';'
8+
- 'Content-Security-Policy-Report-Only: default-src ''self'';'
99
- 'Cross-Origin-Opener-Policy: same-origin'
1010
- 'Cross-Origin-Resource-Policy: same-origin'
1111
- 'Permissions-Policy: interest-cohort=()'

tests/payload-base/final/csp/env.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ NGINX_CSP_STYLE_SRC="https://styles.environment.com data: 'unsafe-inline'"
1414
NGINX_CSP_TRUSTED_TYPES="environment-foo env-bar"
1515
NGINX_CSP_WORKER_SRC="https://workers.environment.com data:"
1616

17-
NGINX_CSP_MODE=report-only
17+
NGINX_CSP_MODE=enforce
1818
NGINX_CSP_REPORT_URI=https://sentry.appwi.se/api/347/security/?sentry_key=foo123
1919
NGINX_FRAME_OPTIONS=sameorigin

tests/payload-base/final/csp/goss.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ http:
33
check envs and secrets:
44
headers:
55
- >-
6-
Content-Security-Policy-Report-Only:
6+
Content-Security-Policy:
77
default-src 'self';
88
child-src https://children.embedded.com 'self' https://children.environment.com data:;
99
connect-src https://connection.embedded.com 'self' https://connection.environment.com data:;

tests/payload-base/final/default/goss.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ http:
55
body:
66
- 'Hey from server.js'
77
headers:
8-
- 'Content-Security-Policy: default-src ''self'';'
8+
- 'Content-Security-Policy-Report-Only: default-src ''self'';'
99
- 'Cross-Origin-Opener-Policy: same-origin'
1010
- 'Cross-Origin-Resource-Policy: same-origin'
1111
- 'Permissions-Policy: interest-cohort=()'

tests/php-base/fpm/csp/env.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ NGINX_CSP_STYLE_SRC="https://styles.environment.com data: 'unsafe-inline'"
1414
NGINX_CSP_TRUSTED_TYPES="environment-foo env-bar"
1515
NGINX_CSP_WORKER_SRC="https://workers.environment.com data:"
1616

17-
NGINX_CSP_MODE=report-only
17+
NGINX_CSP_MODE=enforce
1818
NGINX_CSP_REPORT_URI=https://sentry.appwi.se/api/347/security/?sentry_key=foo123
1919
NGINX_FRAME_OPTIONS=sameorigin

tests/php-base/fpm/csp/goss.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ http:
33
check envs and secrets:
44
headers:
55
- >-
6-
Content-Security-Policy-Report-Only:
6+
Content-Security-Policy:
77
default-src 'self';
88
child-src https://children.embedded.com 'self' https://children.environment.com data:;
99
connect-src https://connection.embedded.com 'self' https://connection.environment.com data:;

0 commit comments

Comments
 (0)