Harden live HTML attachment previews (and add auto-sizing) - #3400
Merged
Conversation
vdvukhzhilov
approved these changes
Jun 19, 2026
formaceft-93
approved these changes
Jun 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
HTML attachments can now keep useful interactive previews while running in an isolated
srcdociframe instead of a same-origin attachment frame. The preview usessandbox="allow-scripts"withoutallow-same-origin,referrerpolicy="no-referrer", and an injected CSP withdefault-src 'none'; base, forms, object/embed, nested frames, workers, navigation, andconnect-srcare blocked, while HTTPS-only scripts, styles, images, media, and fonts remain available for interactive reports.Previews are loaded only when opened and are disabled for unsafe cases: metadata over
10 MiBprevents fetching, fetched HTML over10 MiBis rejected before rendering, and invalid HTML falls back to source plus download when the source is at most2 MiB. Inline preview height now follows the attachment content through a sandbox-to-parent resize message with frame/source validation, per-preview tokens, and a visible height clamp from320pxto1600pxwith a480pxinitial height.fixes #706
Checklist