UI delivery, stage B: single CSP with optional connect-src origins (OVPMON_CSP_CONNECT_EXTRA)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ayurishchevandClaude Sonnet 5.5 committed 2026-10-07 13:28:30 +03:00
1 parent d38acd74de
commit d5e83eaff5
13 files changed
+211 -17

No files matched your search

+8 -4
View File
@@ -8,12 +8,16 @@ server {
# Security headers. add_header in a location replaces the ones inherited from the server block,
# so the /assets/ location below repeats them. CSP: the bundle is served from this origin only;
# style-src 'unsafe-inline' is needed by Bootstrap and Chart.js (inline style attributes);
# connect-src 'self' means config.json must point to proxied paths (the defaults /api/v1 and /profiles-api).
# style-src 'unsafe-inline' is needed by Bootstrap and Chart.js (inline style attributes).
# connect-src is 'self' plus OVP_CSP_CONNECT_EXTRA (origins separated by spaces, empty by default): set it
# only when config.json points the UI to an API on another origin (the defaults /api/v1 and /profiles-api are
# proxied below, same origin). The value is validated by the deploy scripts and by the all-in-one entrypoint.
# One policy ($csp) for both places.
set $csp "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self' ${OVP_CSP_CONNECT_EXTRA}; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'";
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "DENY" always;
add_header Referrer-Policy "no-referrer" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always;
add_header Content-Security-Policy $csp always;
gzip on;
gzip_vary on;
@@ -31,7 +35,7 @@ server {
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "DENY" always;
add_header Referrer-Policy "no-referrer" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always;
add_header Content-Security-Policy $csp always;
}
# The entry page and the runtime configuration must be revalidated after an update