Skip to content

fix(security): CSP IPC para macOS + sanitización SVG del informe clínico - #27

Draft
AtelierMinuit wants to merge 4 commits into
mainfrom
vibe/audit-macos-fixes-deb022
Draft

AtelierMinuit wants to merge 4 commits into
mainfrom
vibe/audit-macos-fixes-deb022

Conversation

@AtelierMinuit

@AtelierMinuit AtelierMinuit commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Audited the app (Tauri v2 + React 19, macOS desktop target): typecheck, build, and tests all pass; Rust backend is solid (path validation, atomic writes, size limits).
  • fix (crítico, macOS): tauri.conf.json CSP now includes ipc: http://ipc.localhost in connect-src. Without it, macOS WKWebView blocks invoke() and the SQL plugin, breaking open/save .trama and the local database.
  • fix (seguridad): ClinicalReportModal sanitizes the ecomap SVG with DOMPurify before dangerouslySetInnerHTML. schematex does not escape user-controlled labels, so an imported .trama file could inject arbitrary markup (XSS) into the clinical report view.
  • Declared dompurify as a direct dependency (it was already in the tree via jspdf's optional deps, so no new packages added).

Verification

  • npx tsc --noEmit ✅
  • pnpm build ✅
  • pnpm test — 4 files / 9 tests passed ✅
  • cargo check fails only in this Linux sandbox due to missing system glib/pkg-config; the macOS build workflow (tauri-build.yml) is unaffected.

UX / Dark mode audit (2nd pass)

  • fix (UX): Editor zoom pill used a non-existent CSS class (zoom-pill-label) so it rendered unstyled, and always showed a static "100%". Now it uses the real .zoom-pill-value class and displays the live zoom level via onViewportChange (clicking it still fits to screen).
  • fix (tema): The "Monocromo" option in Settings had no visual effect: its CSS variables only existed in the legacy App_old.css, which is no longer imported. Restored .theme-monochrome / .theme-dark.theme-monochrome variables in App.css.
  • Dark mode audit: the modern workspace components correctly use CSS variables that switch with theme-dark; connection lines and node colors have adequate contrast in both themes. The clinical report intentionally stays light (A4 printing).
  • Verified: tsc --noEmit ✅, pnpm build ✅, pnpm test 9/9 ✅

Technical debt audit (3rd pass)

  • Removed dead code (~1026 lines): 6 one-shot patch_*.cjs scripts from past redesigns (already applied; re-running them would corrupt current sources), src/App_old.css (35 KB, no longer imported), and unreferenced docs/assets/screenshots/dummy_state.json.
  • CI now runs the test suite: ci.yml previously only built — the 9 existing tests were never validated on PRs. Added pnpm test step and --frozen-lockfile install.
  • Verified: tsc --noEmit ✅, pnpm build ✅, pnpm test 9/9 ✅, YAML valid ✅

mistral-vibe and others added 4 commits October 13, 2026 05:14
…MPurify

- tauri.conf.json: add 'ipc: http://ipc.localhost' to connect-src; without it,
  macOS WKWebView blocks invoke() and the SQL plugin (open/save/DB broken).
- ClinicalReportModal: sanitize projectionSvg (schematex does not escape user
  labels) before dangerouslySetInnerHTML to prevent XSS via imported .trama
  files. dompurify was already in the dependency tree (jspdf optional).
- package.json/pnpm-lock: declare dompurify as a direct dependency.

Co-authored-by: AtelierMinuit <AtelierMinuit@users.noreply.github.com>
…me theme variables

- Editor zoom pill: use the real .zoom-pill-value class (zoom-pill-label
  was unstyled) and show the actual zoom level via onViewportChange
  instead of a static '100%'.
- App.css: restore .theme-monochrome / .theme-dark.theme-monochrome
  variables; they only existed in App_old.css, which is no longer imported,
  so the 'Monochrome' option in Settings had no visual effect.

Co-authored-by: AtelierMinuit <AtelierMinuit@users.noreply.github.com>
- Delete one-shot patch_*.cjs scripts (already applied; re-running them
  would corrupt current sources) and src/App_old.css (35 KB, no longer
  imported anywhere).
- Delete unreferenced docs/assets/screenshots/dummy_state.json.
- CI: install with --frozen-lockfile and run 'pnpm test' before the build;
  the 9 existing tests were never validated on PRs.

Co-authored-by: AtelierMinuit <AtelierMinuit@users.noreply.github.com>
macOS HIG recommends >= 11px for UI text; several labels, small captions
and report fields were at 9-10.5px. Raised to 11px: cmdk-badge (9px),
cmdk-kbd, system-list-item small, stat-pill small, metric-sub, tie-badge,
report-label, modal-template-list small, sidebar legal footer, sidebar
kbd, sidebar-recent-time, diagnosis-stat small, context-menu labels.
Numeric counters in 16px circular badges stay at 10px. Also dropped a
stale duplicate class on the zoom pill label.

Co-authored-by: AtelierMinuit <AtelierMinuit@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants