Add allow-popups-to-escape-sandbox to render_iframe, and rationale
What does this MR do and why?
Add allow-popups-to-escape-sandbox to render_iframe.js's IFRAME_SANDBOX_RESTRICTIONS, and a detailed rationale for each control we select.
This permits a YouTube embed to open a new window with the actual YouTube view page. See #282443 (comment 3256531201) (staff-only) for context.
References
- <iframe> embeds in Markdown content (#282443)
- [FF] allow_iframes_in_markdown -- allow <iframe... (#596742)
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
- Enable the
allow_iframes_in_markdownfeature flag on your GDK. - Under Admin → Settings → General → Embedded content (http://gdk.test:3000/admin/application_settings/general#js-iframe-settings), check "Enable embedded content", add
www.youtube.comto the domain allowlist (thewww.is very important), and click "Save changes". - Restart your GDK. The allowlist setting is heavily cached.
- Using the plain-text editor, embed a YouTube video in a comment or issue/MR description. For example:
Or you can paste a YouTube embed code.
 - The embed should work; you can click on the play button and watch the video.
- Try clicking on the title (per the above videos) to open it in a new window. It shouldn't work.
- Check out this branch, and reload the page.
- Now the embed should work and you should be able to click the title to open it in a new window.
- Nyonkmaspäevast!
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.