Skip to content

fix(web): dashboard security hardening (fonts, nginx version, mock worker, Monaco DOMPurify) - #1091

Merged
ValgulNecron merged 2 commits into
masterfrom
fix/web-dashboard-security-hardening
Nov 24, 2026
Merged

ValgulNecron merged 2 commits into
masterfrom
fix/web-dashboard-security-hardening

Conversation

@ValgulNecron

Copy link
Copy Markdown
Collaborator

Security review of the web dashboard (SPA, nginx image and config, CSP and headers, token storage, redirects, dependencies). This PR fixes every finding.

Findings

# Finding Severity Fix
1 Monaco 0.57.0 bundles its own DOMPurify 3.4.15 (esm/vs/base/browser/dompurify). That version has 5 advisories: GHSA-6688-9rhm-gjv2, GHSA-c6gr-qvv4-5v3f, GHSA-cg2g-xh64-v4q7, GHSA-mrv2-3pqr-j5jr and GHSA-p98j-92pf-mc4p. The overrides entry in package.json can't reach the bundled copy, and npm audit doesn't see it. Monaco's domSanitize.js doesn't use IN_PLACE, SAFE_FOR_TEMPLATES or XHTML parsing, so I found no way to exploit them here. Low monaco-editor 0.58.0, which bundles 3.4.17. It also stops markdown hovers loading remote images by default.
2 Every page, the login page included, loaded a stylesheet from fonts.googleapis.com, and the CSP allowed that host for styles and fonts.gstatic.com for fonts. Third-party CSS ran in the admin origin with no SRI (Google Fonts CSS can't be pinned). Together with img-src https:, that is a working CSS exfiltration channel if the CDN or the path to it is compromised. It also told Google about every visit. Low Fonts are bundled from @fontsource/geist and @fontsource/jetbrains-mono (the same weights the design uses), and both Google hosts are gone from index.html and the CSP.
3 nginx used the default server_tokens on, so the Server header and nginx's own error pages (404/502) showed nginx/1.31.x to unauthenticated visitors. That breaks core rule 3 (no versions before login). Low server_tokens off.
4 The production image served /mockServiceWorker.js, the MSW test worker. It is not registered in production, but any script that runs on the origin could register it and keep a service worker that answers the dashboard's own requests, and it would outlive the page. Low (hardening) New dropMockWorker Vite plugin removes it from non-mock builds. The E2E mock mode runs on the dev server, which still serves public/.

Checked and found sound: sessions use HttpOnly cookies plus a double-submit CSRF header, with no tokens in localStorage. There are no innerHTML or dangerouslySetInnerHTML sinks. External hrefs are constants or https://-checked (modpack download pages). xterm OSC 8 links are limited to http(s). The SPA has no redirect parameter (no open redirect). The custom CSS and theme-vars sanitizers and the boot-script shape check hold. Share tokens stay out of logs and Referer. The web pod runs non-root with a read-only root filesystem and drops all capabilities. API responses carry their own default-src 'none' CSP. npm audit (prod and all) finds 0 vulnerabilities.

Verification

  • npm run build passes (tsc and vite). The built csp.conf no longer lists Google hosts, dist/ has no mockServiceWorker.js, and the bundle carries DOMPurify 3.4.17.
  • web/specs.md documents the browser hardening.
  • No test files changed.
  • CI is the verification authority.

Generated by Claude Code

…naco

- Self-host Geist and JetBrains Mono via @fontsource and drop
  fonts.googleapis.com/fonts.gstatic.com from the page and the CSP, so no
  third-party stylesheet runs in the dashboard origin (login page included).
- nginx: server_tokens off, so the Server header and nginx error pages
  shown to unauthenticated visitors carry no version (core rule 3).
- Production builds no longer ship public/mockServiceWorker.js; only the
  E2E mock mode (dev server) serves it.
- monaco-editor 0.57.0 -> 0.58.0: its bundled DOMPurify goes from 3.4.15
  to 3.4.17 (GHSA-6688-9rhm-gjv2, GHSA-c6gr-qvv4-5v3f, GHSA-cg2g-xh64-v4q7,
  GHSA-mrv2-3pqr-j5jr, GHSA-p98j-92pf-mc4p); the package.json override
  cannot reach the vendored copy. Markdown hovers also stop loading
  remote images by default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 4 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a0407a6 and 6728e0b.

Files ignored due to path filters: 1

  • web/package-lock.json is excluded by !**/package-lock.json
Files selected for processing: 7

  • changelog/unreleased/1091-dashboard-security-hardening.md
  • web/index.html
  • web/nginx.conf.template
  • web/package.json
  • web/specs.md
  • web/src/main.tsx
  • web/vite.config.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
@ValgulNecron ValgulNecron added area: web React dashboard type: security Security hardening or vulnerability fix labels Nov 24, 2026 — with Claude
@ValgulNecron ValgulNecron self-assigned this Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

CI Report - 6728e0b

run 45296684924 - attempt 1

0 failed - 11 passed - 22 skipped - 27m33s elapsed

Test selection: partial - per-suite table

Coverage

Module Measured Gate Margin
web L94.3 S92.48 B87.49 F90.28 L92 S92 B82 F76 +0.48

Changed

Area Files +/-
web/ 7 +80/-17
changelog/ 1 +3/-0

Slowest jobs

Job Duration
build e2e images 14m21s
e2e web live / amd64 (kind) 12m43s
e2e web live / arm64 (kind) 11m17s
build e2e images (arm64) 8m57s
web 8m13s

e2e buckets run

multicluster, upgrade

@ValgulNecron
ValgulNecron marked this pull request as ready for review November 24, 2026 00:51
@ValgulNecron
ValgulNecron merged commit df2cc9e into master Nov 24, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: web React dashboard type: security Security hardening or vulnerability fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants