Skip to content

Commit f5c48f5

Browse files
committed
fix: self-host Boxicons to comply with strict CSP
Replace the external CDN link to pro.boxicons.com with locally hosted font files, avoiding Content Security Policy violations from Helmet.
1 parent c674073 commit f5c48f5

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

CLAUDE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,21 @@ See `packages/backend/.env.example` for all variables. Key ones:
272272
- **Tenant**: A user's data boundary. Created from `user.id` on first agent creation.
273273
- **Agent**: An AI agent owned by a tenant. Has a unique OTLP ingest key.
274274

275+
## Content Security Policy (CSP)
276+
277+
Helmet enforces a strict CSP in `main.ts`. The policy only allows `'self'` origins — **no external CDNs are permitted**.
278+
279+
**Rule: Never load external resources from CDNs.** All assets (fonts, icons, stylesheets) must be self-hosted under `packages/frontend/public/`. This keeps the CSP strict and avoids third-party dependencies at runtime.
280+
281+
Current self-hosted assets:
282+
- **Boxicons Duotone**`public/fonts/boxicons/` (CSS + woff/ttf font files)
283+
284+
To add a new font or icon library:
285+
1. Download the CSS and font files into `packages/frontend/public/`
286+
2. Rewrite any CDN URLs inside the CSS to use relative paths (`./filename.woff`)
287+
3. Reference the local CSS in `index.html` (e.g. `<link href="/fonts/..." />`)
288+
4. Do **not** add external domains to the CSP directives
289+
275290
## Architecture Notes
276291

277292
- **Single-service**: In production, `@nestjs/serve-static` serves `frontend/dist/` with SPA fallback. API routes (`/api/*`, `/otlp/*`) are excluded.

packages/frontend/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<link rel="icon" href="/favicon.ico" />
7-
<link href="https://pro.boxicons.com/fonts/3.0.8/duotone/regular/200/boxicons-duotone.min.css?sig=ccbb17a30bbd11285764bc03d85132b669dfe25ae1c170743de4040a31577782" rel="stylesheet" />
7+
<link href="/fonts/boxicons/boxicons-duotone.min.css" rel="stylesheet" />
88
<title>Manifest</title>
99
<meta name="description" content="AI agent observability platform — monitor costs, tokens, and performance." />
1010
<meta property="og:title" content="Manifest" />

packages/frontend/public/fonts/boxicons/boxicons-duotone.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
395 KB
Binary file not shown.
175 KB
Binary file not shown.

0 commit comments

Comments
 (0)