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
Commit ddce89f
Browse filesBrowse the repository at this point in the historyBrowse files
fix(media): keep script-capable sources out of links and frames
Addresses findings 2, 3 and 4 of #142.
2. The Download link reused the media-element allowlist, which lets a
data:image/svg+xml through: safe in an <img>, but as a target="_blank"
href it opens an SVG document that can run script. The link now uses
a "link" sink (the old "frame" sink, renamed now that no frame uses
it) that takes only http:, https: and blob:. A data: image still
shows; it is just not offered for download.
3. PDFs rendered in an unsandboxed <iframe>, so a URL labelled as a PDF
that serves HTML ran script, same-origin for blob: and same-origin
http(s), and could navigate the top page. A short spike, run in
Playwright's new-headless Chromium and in installed Chrome stable,
showed Chrome refuses its PDF viewer in any sandboxed frame. It shows
the "blocked" page for sandbox="", "allow-scripts", "allow-same-origin"
and even "allow-scripts allow-same-origin", which would also void the
sandbox for a same-origin URL. <object>/<embed> were not tried: per
the HTML spec they follow the response's Content-Type, so they would
not refuse HTML either. Proving the bytes are
a PDF would mean fetching the URL, which needs CORS and goes against
the package's no-fetching rule. So a PDF now gets the "No preview for
this file." state with its Download link, which in Chrome opens the
native viewer in a new tab.
4. When the open item fell off a shortened list, the index read as
closed but stayed stored, so the viewer reopened when the list grew
back. An effect keyed on falling out of range now commits the close:
uncontrolled state clears, and a controlled caller gets one
onIndexChange(null) even if it keeps passing the stale index.
0 commit comments