Files
pad/internal
xarmian fdc6b221d0 test(collab): regression guard for share-page collab isolation (TASK-1266) (#464)
The public /s/{token} share page must keep rendering markdown via
marked + DOMPurify and never open a WebSocket to /api/v1/collab —
anonymous viewers can't authenticate, and exposing per-item Y.Doc
traffic to the public internet would be a security regression.

This is a verification task: zero production code changes. Adds
TestSharePageDoesNotImportCollab in internal/server which:

- Walks the import closure rooted at the share-page +page.svelte
  (resolves $lib/ aliases, relative paths, conventional extensions,
  static AND dynamic `import(...)` forms; skips external packages)
- Asserts no file in the closure contains forbidden tokens:
  wsProvider, CollabProvider, @tiptap/extension-collaboration,
  @tiptap/y-tiptap, 'yjs' / "yjs", y-protocols, Editor.svelte
  (suffix), WebSocket, /api/v1/collab
- Asserts the route file still imports + invokes marked and
  DOMPurify.sanitize (catches a renderer swap)
- Strips comments before all checks so leftover commented-out
  imports can't bypass

Verified by injection: direct AND transitive AND dynamic-import
regressions all fail the test.

Four rounds of Codex review.
2026-05-09 07:13:10 -04:00
..
2026-03-26 01:52:36 +00:00