fix(boardwalk): add form-action and frame-src to the admin CSP

- form-action 'self': injected markup cannot post a native form off-origin
- frame-src 'none': no framed content; a sandboxed srcdoc preview is not
  fetched and still renders
- header tests, README and admin-spa docs name the directives
This commit is contained in:
2026-10-12 20:41:21 +02:00
parent 71bd614a95
commit 2343788624
4 changed files with 12 additions and 8 deletions

View File

@@ -310,7 +310,7 @@ func TestSecurityHeadersOnEveryResponse(t *testing.T) {
"X-Content-Type-Options": "nosniff",
"Referrer-Policy": "same-origin",
"X-Frame-Options": "DENY",
"Content-Security-Policy": "frame-ancestors 'none'; base-uri 'none'; object-src 'none'; script-src 'self'",
"Content-Security-Policy": "frame-ancestors 'none'; base-uri 'none'; object-src 'none'; script-src 'self'; form-action 'self'; frame-src 'none'",
"X-Robots-Tag": "noindex, nofollow",
} {
if got := rec.Header().Get(header); got != want {
@@ -482,7 +482,7 @@ func TestPhase101BoardwalkExports(t *testing.T) {
"X-Content-Type-Options": "nosniff",
"Referrer-Policy": "same-origin",
"X-Frame-Options": "DENY",
"Content-Security-Policy": "frame-ancestors 'none'; base-uri 'none'; object-src 'none'; script-src 'self'",
"Content-Security-Policy": "frame-ancestors 'none'; base-uri 'none'; object-src 'none'; script-src 'self'; form-action 'self'; frame-src 'none'",
"X-Robots-Tag": "noindex, nofollow",
}
if len(h) != len(want) {