Revert site-wide CSP from shared security headers
Deploy with Docker Compose / deploy (push) Successful in 26s
Deploy with Docker Compose / deploy (push) Successful in 26s
03e10be introduced the CSP before it was tested against the SPA's wasm
loader and the Gitea proxy. Gitea's own templates emit inline <script>
blocks, so the shared script-src would need 'unsafe-inline' to keep it
working — a CSP that weak nulls out most of its protection. Drop the
header site-wide; the /uploads/ locked-down CSP stays.
Co-Authored-By: Claude Code <[email protected]>
This commit is contained in:
@@ -14,9 +14,10 @@ add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" alway
|
|||||||
# Applied to the main document; the /uploads/ blocks override with their own
|
# Applied to the main document; the /uploads/ blocks override with their own
|
||||||
# locked-down CSP by declaring Content-Security-Policy again themselves
|
# locked-down CSP by declaring Content-Security-Policy again themselves
|
||||||
# (a later add_header of the same name within one response wins).
|
# (a later add_header of the same name within one response wins).
|
||||||
# 'wasm-unsafe-eval' is needed for WebAssembly compilation (the Rust
|
#
|
||||||
# AutoScroll module, vue/crates/stp_wasm): without it script-src falls back
|
# ponytail: no site-wide CSP from nginx here. The SPA needs
|
||||||
# to default-src 'self', which blocks WebAssembly.instantiateStreaming() in
|
# 'wasm-unsafe-eval' for its Rust module, Gitea (proxied at /gitea/) relies
|
||||||
# every modern browser. It allows wasm compilation only, not JS eval, so it
|
# on inline <script> blocks its own templates generate, so a shared
|
||||||
# is the narrowest keyword that unblocks the feature.
|
# script-src would need 'unsafe-inline' — which voids almost all of CSP's
|
||||||
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; img-src 'self' data: https:; style-src 'self' 'unsafe-inline'; font-src 'self' data:; connect-src 'self'; frame-ancestors 'self'; base-uri 'self'; object-src 'none'" always;
|
# value. If a real CSP matters again, give the SPA document its own
|
||||||
|
# script-src 'self' 'wasm-unsafe-eval' location, separate from Gitea.
|
||||||
|
|||||||
Reference in New Issue
Block a user