feat(csp): allow chat UI to be embedded in iframes#3643
feat(csp): allow chat UI to be embedded in iframes#3643waleedlatif1 merged 2 commits intostagingfrom
Conversation
Mirror the existing form embed CSP pattern for chat pages: add getChatEmbedCSPPolicy() with frame-ancestors *, configure /chat/:path* headers in next.config.ts without X-Frame-Options, and early-return in proxy.ts so chat routes skip the strict runtime CSP. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
You have used all Bugbot PR reviews included in your free trial for your GitHub account on this workspace. To continue using Bugbot reviews, enable Bugbot for your team in the Cursor dashboard. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR enables the built-in chat UI ( Key changes:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Browser as Browser (3rd-party origin)
participant Middleware as Next.js Middleware (proxy.ts)
participant Config as next.config.ts Headers
participant ChatPage as /chat/:id Page
Browser->>Config: GET /chat/abc123
Config-->>Browser: Content-Security-Policy: frame-ancestors *<br/>Cross-Origin-Embedder-Policy: unsafe-none<br/>Cross-Origin-Opener-Policy: unsafe-none<br/>(no X-Frame-Options)
Browser->>Middleware: request reaches proxy()
Middleware-->>Browser: NextResponse.next() — no CSP override
Middleware->>ChatPage: render chat UI
ChatPage-->>Browser: HTML response (embeddable in iframe)
Note over Browser,ChatPage: Before this PR: catch-all added X-Frame-Options: SAMEORIGIN<br/>and middleware set frame-ancestors 'self' → embedding blocked<br/>After this PR: both restrictions lifted for /chat/* routes
Last reviewed commit: "feat(csp): allow cha..." |
Deduplicate getChatEmbedCSPPolicy and getFormEmbedCSPPolicy into a shared private helper to prevent future divergence. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(mothership): fix mothership file uploads (#3640) * Fix files * Fix * Fix * fix(workspace): prevent stale placeholder data from corrupting workflow registry on switch * feat(csp): allow chat UI to be embedded in iframes (#3643) * feat(csp): allow chat UI to be embedded in iframes Mirror the existing form embed CSP pattern for chat pages: add getChatEmbedCSPPolicy() with frame-ancestors *, configure /chat/:path* headers in next.config.ts without X-Frame-Options, and early-return in proxy.ts so chat routes skip the strict runtime CSP. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(csp): extract shared getEmbedCSPPolicy helper Deduplicate getChatEmbedCSPPolicy and getFormEmbedCSPPolicy into a shared private helper to prevent future divergence. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * fix(logs): add durable execution diagnostics foundation (#3564) * fix(logs): persist execution diagnostics markers Store last-started and last-completed block markers with finalization metadata so later read surfaces can explain how a run ended without reconstructing executor state. * fix(executor): preserve durable diagnostics ordering Await only the persistence needed to keep diagnostics durable before terminal completion while keeping callback failures from changing execution behavior. * fix(logs): preserve fallback diagnostics semantics Keep successful fallback output and accumulated cost intact while tightening progress-write draining and deduplicating trace span counting for diagnostics helpers. * fix(api): restore async execute route test mock Add the missing AuthType export to the hybrid auth mock so the async execution route test exercises the 202 queueing path instead of crashing with a 500 in CI. * fix(executor): align async block error handling * fix(logs): tighten marker ordering scope Allow same-millisecond marker writes to replace prior markers and drop the unused diagnostics read helper so this PR stays focused on persistence rather than unread foundation code. * fix(logs): remove unused finalization type guard Drop the unused helper so this PR only ships the persistence-side status types it actually uses. * fix(executor): await subflow diagnostics callbacks Ensure empty-subflow and subflow-error lifecycle callbacks participate in progress-write draining before terminal finalization while still swallowing callback failures. --------- Co-authored-by: test <test@example.com> Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai> * feat(admin): add user search by email and ID, remove table border - Replace Load Users button with a live search input; query fires on any input - Email search uses listUsers with contains operator - User ID search (UUID format) uses admin.getUser directly for exact lookup - Remove outer border on user table that rendered white in dark mode - Reset pagination to page 0 on new search Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(admin): replace live search with explicit search button - Split searchInput (controlled input) from searchQuery (committed value) so the hook only fires on Search click or Enter, not every keystroke - Gate table render on searchQuery.length > 0 to prevent stale results showing after input is cleared Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Siddharth Ganesan <33737564+Sg312@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: PlaneInABottle <y.mirza.altay@gmail.com> Co-authored-by: test <test@example.com> Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
Summary
getChatEmbedCSPPolicy()incsp.tsmirroring the existing form embed pattern, settingframe-ancestors: *to allow cross-origin iframe embedding/chat/:path*headers block innext.config.tswith noX-Frame-Options, permissive COEP/COOP, matching the form embed configurationproxy.tsto early-return for/chat/routes (CSP applied via next.config.ts headers, not middleware)/chat/*routes (waschat$which only matched/chatexactly)Context
Users reported that embedding the built-in chat UI within an iframe is not possible due to CSP restrictions (
frame-ancestors: 'self'andX-Frame-Options: SAMEORIGIN). Form embeds already support this — this PR applies the same pattern to chat.Test plan
/chat/<id>frame-ancestors: 'self')