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
fix(viewer): render rich parts same-origin with a nonce'd CSP
Rich parts (markdown/diff/terminal/mermaid) render in opaque-origin
sandboxed srcdoc iframes. On Chrome 149 a field-trial experiment defers
layout in opaque-origin srcdoc iframes specifically: every measurement
(scrollHeight/offsetHeight/getBoundingClientRect) reads 0 until layout
eventually lands — and for off-screen frames it may never land — so the
in-frame bridge reports 0 and the part renders blank/collapsed. The
fixed-timer reporting (and #85's single re-parse) can't reliably catch
the late layout; it's a timing race that differs on every refresh.
Fix: remove the actual trigger by rendering rich parts same-origin
(sandbox="allow-scripts allow-same-origin") — same-origin srcdoc frames
lay out synchronously — and preserve the #65 isolation with a per-document
nonce CSP: script-src 'nonce-<n>' instead of 'unsafe-inline', with the
nonce only on the trusted bridge script. An injected <script> (sanitizer
regression) lacks the nonce and is blocked by CSP, so the same-origin
access can't be abused. Drops the now-unnecessary re-parse workaround.
HTML parts (/s/:id) are intentionally unchanged.
Verified on Chrome/149.0.0.0: rich parts render identically on every
reload (deterministic); no CSP violations.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments