Skip to content

Commit f773a63

Browse files
authored
Merge pull request #25 from doublewordai/fix/sign-in-bug
content src fix
2 parents 5b046f8 + d92982b commit f773a63

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/middleware.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
2130
function 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

Comments
 (0)