fix(csp): add frame-src so signed-PDF previews + embedded signing load
All checks were successful
Build & Push Docker Images / lint (push) Successful in 2m55s
Build & Push Docker Images / build-and-push (push) Successful in 8m22s

The CSP set default-src 'self' with no frame-src, so it fell back to
'self' for frames. Inline signed-EOI previews iframe a presigned
s3.portnimara.com URL and the admin embedded-signing card iframes the
Documenso host — both were blocked, rendering a broken-file placeholder
("Framing 'https://s3.portnimara.com/' violates ... default-src 'self'").

Add `frame-src 'self' blob: https:` to both CSP definitions (proxy.ts
middleware + next.config.ts), matching the existing https: posture of
img-src/connect-src. frame-ancestors 'none' is unchanged, so we still
can't be embedded by third parties.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-25 14:26:38 +02:00
parent fc994cd88b
commit 3f6f845c02
2 changed files with 10 additions and 0 deletions

View File

@@ -53,6 +53,10 @@ const csp = [
"img-src 'self' data: blob: https:",
"font-src 'self' data:",
`connect-src 'self' ws: wss: https:${devConnectHosts}`,
// PDF previews iframe a presigned storage URL; embedded-signing iframes the
// Documenso host. Both are per-port/per-env, so allow https: (matching
// img-src). frame-ancestors 'none' still blocks others from embedding us.
"frame-src 'self' blob: https:",
"frame-ancestors 'none'",
"base-uri 'self'",
"form-action 'self'",

View File

@@ -29,6 +29,12 @@ function buildCspWithNonce(nonce: string, isProd: boolean): string {
"img-src 'self' data: blob: https:",
"font-src 'self' data:",
connectSrc,
// PDF previews (signed EOIs etc.) iframe a presigned storage URL, and the
// embedded-signing card iframes the Documenso host. Both are per-port /
// per-env hosts, so allow https: (matching img-src/connect-src). This is
// what WE may embed; frame-ancestors 'none' below still blocks others
// from embedding us.
"frame-src 'self' blob: https:",
"frame-ancestors 'none'",
"base-uri 'self'",
"form-action 'self'",