Skip to content

fix(markdown): secure browser document bindings - #2969

Draft
George Ng (GeorgeNgMsft) wants to merge 4 commits into
mainfrom
georgengmsft-markdown-browser-server
Draft

fix(markdown): secure browser document bindings#2969
George Ng (GeorgeNgMsft) wants to merge 4 commits into
mainfrom
georgengmsft-markdown-browser-server

Conversation

@GeorgeNgMsft

@GeorgeNgMsft George Ng (GeorgeNgMsft) commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Layer 4 of native stack #2970, rebased in place onto current main after #2968 merged.

  • validate browser and IPC reads/writes against the active binding token, workspace identity, content revision, and a single-use durable-read provenance token
  • preserve nested relative paths and isolate same-basename documents with binding-scoped collaboration rooms
  • serialize browser binding transitions and SSE processing so stale switch responses cannot attach the editor to the wrong room
  • reject stale/concurrent writes, detect external disk edits throughout browser-backed reads, and prevent AI snapshots from overwriting newer editor changes
  • hydrate the authoritative Yjs document on file load and keep HTTP content/revision snapshots coherent
  • keep the Markdown HTTP/WebSocket service on IPv4 loopback and advertise its bound loopback port
  • extract focused IPC and SSE handlers without changing protocol behavior so the complexity ratchet remains at baseline

Rebase

  • Replayed only fix(markdown): secure browser document bindings #2969's two commits from historical parent ab068c61a3275cad6762f82d0a10de6338e37931 onto main at c9eeb933b317afe2e29a432b325eabf02e8c1871.
  • Preserved current main's existing-only /file/load behavior and adapted browser fallbacks to the hardened asynchronous bound-document reader.
  • Current head: 256e472ae4081646a95376dda6ffce7089ab6f4a.
  • Diff against main: 14 files changed, 2,175 insertions, 622 deletions.

Validation

  • pnpm run build markdown
  • pnpm --filter '@typeagent/markdown-agent' test — 98/98 tests passing
  • Prettier on all changed files
  • lint ratchet against origin/main
  • complexity ratchet against origin/main — over-threshold counts remain unchanged at 1 cyclomatic and 1 cognitive
  • circular-dependency ratchet against origin/main
  • debt-marker gate against origin/main
  • git diff --check
  • repeated adversarial reviews with GPT-5.6 Sol and Grok 4.6; findings were fixed and regression-covered
  • final complexity-only refactor independently reviewed by GPT-5.6 Sol and Grok 4.6 with no substantive findings

Stack

Native stack #2970 remains unchanged and ordered as [2966, 2967, 2968, 2969, 2971], including merged #2966, #2967, and #2968. This PR remains draft with base main; no stack metadata or #2971 branch content was modified.

@GeorgeNgMsft
George Ng (GeorgeNgMsft) force-pushed the georgengmsft-markdown-browser-server branch from 7bb4504 to 876bdb5 Compare September 3, 2026 23:01
@GeorgeNgMsft
George Ng (GeorgeNgMsft) force-pushed the georgengmsft-markdown-browser-server branch from 876bdb5 to 3f3cd47 Compare September 5, 2026 05:29
Base automatically changed from georgengmsft-markdown-durable-updates to main September 10, 2026 01:56
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@GeorgeNgMsft
George Ng (GeorgeNgMsft) force-pushed the georgengmsft-markdown-browser-server branch from 3f3cd47 to 970bb9d Compare September 11, 2026 00:57
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

1 participant