Mateusz PstruchaandClaude Opus 5 f0b42baa50
CI / build (push) Successful in 14s
Add read-only mail view
Thread-grouped list, thread view with older messages collapsed, and
keyboard navigation (j/k, Enter/o, u/Esc, g/G, r, ?). Mutating shortcuts
are deliberately absent until the endpoints behind them exist.

Untrusted mail renders in an iframe sandboxed without allow-scripts or
allow-same-origin, with a CSP inside the frame doing the actual blocking
of remote loads. CSP rather than rewriting <img src> because rewriting
misses srcset, <picture>, CSS background-image and @font-face; img-src
covers every image load however it was requested. Remote images stay
blocked per message until the reader opts in.

Verified against mail carrying a tracking pixel, remote hero image, CSS
background image and inline <script>: the script neither ran nor reached
the parent, the frame was not same-origin accessible, and no request was
made even for a resolvable, actively-served image URL.

Note the quotes in img-src 'none' are load-bearing — unquoted, CSP reads
'none' as a hostname and would allow https://none/pixel.gif.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 22:53:24 +02:00
2026-09-22 19:01:07 +02:00
2026-09-22 19:01:07 +02:00
2026-09-22 22:53:24 +02:00
2026-09-22 19:01:07 +02:00
2026-09-22 19:01:07 +02:00
2026-09-22 19:01:07 +02:00
2026-09-22 22:13:40 +02:00
2026-09-22 22:53:24 +02:00
2026-09-22 19:01:07 +02:00
2026-09-22 19:01:07 +02:00
2026-09-22 22:53:24 +02:00

tern-web

Desktop webapp client for Tern — see docs/webapp-client-spec.md and docs/branding-spec.md.

Status: read-only mail view (build order phase 3). What's here:

  • Vite + Svelte 5 + TypeScript, no other runtime dependencies, per the spec's "fast and simple" priority (§1) and browser-API-only approach (§5).
  • The decided color palette wired up as CSS custom properties with data-theme light/dark/system switching (§4).
  • Two-pane desktop layout as the base case, not a breakpoint-unlocked extra (§4a): folders / thread list / reading pane.
  • Thread-grouped list, one row per conversation, with unread weighting, message counts and attachment markers.
  • Thread view with older messages collapsed and the newest expanded.
  • Sandboxed HTML mail rendering with remote images blocked by default (§6) — see below.
  • Keyboard shortcuts (§4a): j/k, Enter/o, u/Esc, g/G, r, ?. Mutating shortcuts (e, c) are deliberately absent until the endpoints behind them exist — a shortcut that silently does nothing is worse than one that doesn't exist.
  • Polls /events while the tab is open, since WebSocket push is phase 7.
  • No PWA, no service worker, no offline cache — matches §2's explicit scope cut.

How untrusted mail is rendered

Two independent defences in src/lib/MessageBody.svelte:

  1. sandbox with neither allow-scripts nor allow-same-origin. Scripts never run, and the frame gets an opaque origin, so even if something did execute it couldn't reach the app's DOM, cookies or storage.
  2. A CSP <meta> inside the frame, which is what actually blocks remote loads. This is done with CSP rather than by rewriting <img src> because rewriting only catches what you remember to look for — it misses srcset, <picture>, CSS background-image and @font-face. img-src covers every image load however it was requested.

Remote images stay blocked until the reader opts in per message, since loading them is what confirms to a sender that the mail was opened.

Verified against a message containing a tracking pixel, a remote hero image, a CSS background image and an inline <script>: the script did not execute or reach the parent document, the frame was not same-origin accessible, and no network request was made even for an image URL that was resolvable and actively served. The opt-in path is verified at the policy level (the CSP switches to img-src https: data:).

Note the quotes in img-src 'none' are load-bearing — unquoted, CSP parses none as a hostname, which would let https://none/pixel.gif through.

Not built yet (later phases): compose/reply, tag/rule management UI, search, attachment download, mutation actions (mark read, archive, tag), WebSocket live updates.

Running

Requires tern-server running on 127.0.0.1:8080 (see ../server/README.md) — the dev server proxies /api to it.

npm install
npm run dev

npm run check runs svelte-check for type errors.

S
Description
No description provided
Readme
360 KiB
0 Stars 1 Watchers 0 Forks
v0.8.5
Latest
2026-11-24 20:15:43 +01:00
Languages
Svelte 80.2%
TypeScript 18.4%
CSS 0.8%
HTML 0.5%