@@ -16,8 +16,17 @@ import {NextRequest, NextResponse} from 'next/server'
1616//
1717// `style-src` keeps `'unsafe-inline'`: Tailwind/Next emit inline styles, and
1818// inline styles are not a script-execution vector. `frame-src` allows the
19- // Sanity-authored video embeds; `connect-src 'self'` covers PostHog via the
20- // /ingest rewrite.
19+ // Sanity-authored video embeds. `connect-src` includes:
20+ // - `'self'` (covers PostHog via the /ingest rewrite)
21+ // - `https://app.doubleword.ai` for the sign-in flow — the auth callback
22+ // page on docs.doubleword.ai fetches
23+ // `/admin/api/v1/users/current/api-keys` from app.doubleword.ai with
24+ // `credentials: 'include'` to verify the SSO session. CORS is already
25+ // allowed on the control-layer side (see
26+ // internal/values/control-layer.yaml `allowed_origins`).
27+ // - `https://status.doubleword.ai` for the StatusWidget component, which
28+ // fetches `/api/v1/summary` from the public status page to render
29+ // live incident status inline in docs pages.
2130function buildCsp ( nonce : string ) : string {
2231 return [
2332 "default-src 'self'" ,
@@ -26,7 +35,7 @@ function buildCsp(nonce: string): string {
2635 "style-src 'self' 'unsafe-inline'" ,
2736 "img-src 'self' data: blob: https://cdn.sanity.io" ,
2837 "font-src 'self' data:" ,
29- "connect-src 'self'" ,
38+ "connect-src 'self' https://app.doubleword.ai https://status.doubleword.ai " ,
3039 'frame-src https://www.youtube.com https://www.youtube-nocookie.com https://player.vimeo.com' ,
3140 "worker-src 'self' blob:" ,
3241 "frame-ancestors 'none'" ,
0 commit comments