Linora

0403. Web shell: app-level notices, continuous follow, reconnect triggers, CSRF cookie names, CSP

Status: Accepted (2026-11-28, ED1). Extends 0402.

Context

Wave-2 follow-ups and review findings for apps/web:

Decision

  1. App-level notices. appState.notify(text) sets a ValueStore. ShellNotice renders it above every route for 5 s. The FileController leaves a deleted or no-longer-accessible file through exit(): one notice, then navigation. This covers the file_deleted / access_revoked file events and the access_revoked fatal close. The message stays on screen after the editor unmounts.
  2. Continuous follow. Clicking an avatar sends {follow: clientId}. While following, the controller applies the followee’s latest viewport, at most once per frame (from its peers callback).
    • Following stops on a manual pan or zoom (the editor’s usercamera event: wheel, pan drag, zoom keys and buttons, fit), Escape, a second click, the followee leaving, or a page switch. The controller then sends {follow: null}.
    • setViewport itself does not fire usercamera, so following never cancels itself.
    • The editor hides remote cursors outside the viewport grown by PRESENCE_VIEW_MARGIN: the server stops relaying them there, so their last position is stale.
  3. Reconnect triggers. The controller calls the sync client’s RemoteSyncClient.retryNow() (DC2, b0fe7ce: skips the pending backoff timer; a no-op unless offline and waiting) on online and on visibilitychange to visible. The sync client stays DOM-free.
  4. CSRF. The X-CSRF-Token response header (signup, login, GET /v1/me) is preferred. The fallback cookie is __Host-linora_csrf, then linora_csrf (csrfFromCookies, unit-tested with the production names).
  5. CSP. The app needs no 'unsafe-inline' or 'unsafe-eval':
    • no inline scripts;
    • no style attributes in markup: styles come from CSS files, React and the editor set styles through the CSSOM, and the caret blink uses the Web Animations API;
    • the icons are static SVG markup;
    • the Inter font is loaded through FontFace from bundled URLs. Policy for O1:
      default-src 'self'; script-src 'self'; style-src 'self'; font-src 'self'; img-src 'self' data:;
      connect-src 'self' wss://<realtime host>; worker-src 'none'; object-src 'none'; base-uri 'none';
      form-action 'self'; frame-ancestors 'none'
      
    • connect-src must list the realtime origin returned by POST /v1/realtime/token (LINORA_REALTIME_URL). On a same-origin deployment, list its wss:// form next to 'self', since some browsers don’t treat ws(s) as covered by 'self'.
    • Verified on a production build: one external module script and one stylesheet, no eval or new Function, no workers or blob URLs, no url() in the CSS.
    • img-src data: covers the empty favicon.

Alternatives

Consequences