Commit adf08e4
authored
fix(web): allow integration logos through CSP (#117)
## Summary
- allow the exact Composio logo origin in the browser `img-src` policy
so skill cards render their brand marks
- remove the redundant Next.js `remotePatterns` entry because these SVGs
use `unoptimized` and bypass the optimizer
- route browser takeover through Cheatcode's authenticated preview proxy
instead of adding Daytona vendor hosts to `frame-src`
## Architecture
The web app remains deny-by-default at the browser boundary. Integration
logo URLs and the CSP origin share one constant. All sandbox iframes,
including noVNC browser takeover, now stay behind the existing
`*.trycheatcode.com` preview-proxy boundary.
## Decisions Made
| Decision | Choice | Alternative | Reasoning |
|---|---|---|---|
| Logo permission | exact `https://logos.composio.dev` `img-src` origin
| wildcard image hosts | smallest permission that serves the catalog |
| Next image config | remove `remotePatterns` | maintain two allowlists
| `unoptimized` returns the raw source and does not use the optimizer
allowlist |
| Browser takeover | owned preview proxy | allow Daytona preview apexes
in `frame-src` | avoids vendor-domain CSP expansion and matches the
documented preview architecture |
## Edge Cases Handled
| Scenario | Handling |
|---|---|
| malformed or unusual integration slug | URL path segment is encoded
before rendering |
| logo endpoint fails | existing initials fallback remains in place |
| noVNC WebSocket traffic | existing preview proxy WebSocket relay
remains the transport |
| local preview routing | existing local preview handoff supports the
generated proxy URL |
## How to Review
1. Review `apps/web/next.config.ts` and
`apps/web/src/lib/integration-logo.ts` for the CSP boundary.
2. Review `integration-brand-logo.tsx` for the shared URL builder.
3. Review `project-sandbox-content.ts` for the browser-takeover proxy
alignment.
## Verification
- [x] `pnpm lint`
- [x] `pnpm typecheck`
- [x] `pnpm turbo build --force`
- [x] `pnpm turbo skills:build`
- [x] `pnpm deadcode`
- [x] `pnpm architecture:check`
- [x] optimized local server returned the production CSP with the
Composio origin
- [x] Chrome loaded `https://logos.composio.dev/api/gmail` under that
CSP at 128×1281 parent b947a51 commit adf08e4
4 files changed
Lines changed: 16 additions & 5 deletions
File tree
- apps
- agent-worker/src/durable-objects
- web
- src
- components/skills
- lib
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
381 | | - | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
382 | 387 | | |
383 | 388 | | |
384 | 389 | | |
385 | | - | |
| 390 | + | |
386 | 391 | | |
387 | 392 | | |
388 | 393 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | | - | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
90 | | - | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | | - | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments