You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
viewer: escape ts and superseded_by cells in page.html (stored-XSS defense-in-depth) #11
Found while reviewing #10 (viewer request guards). The bundled page renders store data via innerHTML; every field passes through esc()except two cells:
src/viewer/page.html — the ts cell: ${m.ts.split("T")[0]} and ${(m.ts.split("T")[1] || "").slice(0,8)} (~line 201)
src/viewer/page.html — the superseded badge: badge("status-superseded", \superseded → ${m.superseded_by.slice(0,8)}`); badge()` (~line 229) interpolates its text argument raw into HTML.
Why it matters
Store values come from files on disk. ts and superseded_by are normally written by code as ISO timestamps, but the record-split injection fixed in #9 was exactly the route by which a hostile memory_import file or auto-capture could plant arbitrary values in those fields. A value like <img src=x onerror=…> would execute in the viewer's own origin, inheriting its same-origin write access to the whole store.
#9 closes the injection route; the reader should still not trust the store (defense in depth).
Fix
Wrap both cells in esc(). One-line change each. Add a test seeding a row whose superseded_by contains HTML and asserting the rendered page escapes it (or at least a unit test on the render helper if extracted).
Related: the sibling hardening of validating ts shape at read time is tracked separately.
Activity
chore(release): 0.3.3 [skip ci]
fix(viewer): parse the Host-derived URL inside a guard; add nosniff +…
chore: drop the security review doc from this branch
Merge pull request #33 from abogartz/fix/viewer-cell-escaping
chore(release): 0.6.1 [skip ci]
abogartz-opencode-self-improvement commentedon Oct 22, 2026
🎉 This issue has been resolved in version 0.6.1 🎉
The release is available on:
Your semantic-release bot 📦🚀