Add sandbox attribute to EmbeddedDemo iframe to prevent blocked navigation#85125
Draft
Add sandbox attribute to EmbeddedDemo iframe to prevent blocked navigation#85125
Conversation
…navigation The Storylane test drive tour iframe navigates to www.storylane.io when the Expensify logo is clicked, but that page blocks framing via X-Frame-Options and CSP headers, showing "This content is blocked." Adding the sandbox attribute without allow-top-navigation prevents the iframe from navigating to non-embeddable URLs while keeping the tour functional. Co-authored-by: Shridhar Goel <ShridharGoel@users.noreply.github.com>
7 tasks
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.
Explanation of Change
When a new user clicks "Take a 2-minute test drive," a Storylane interactive tour opens in an iframe. If the user clicks the Expensify logo inside the tour, the iframe navigates to
www.storylane.io, which returns anti-framing headers (X-Frame-Options: SAMEORIGINand CSPframe-ancestors 'self'), causing the browser to display "This content is blocked."This PR adds the
sandboxattribute to the<iframe>inEmbeddedDemowithallow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox. By omittingallow-top-navigation, the browser blocks the iframe from navigating itself to the non-embeddable URL, while the Storylane tour continues to function normally (scripts, same-origin access, and popups still work).Fixed Issues
$ #82517
PROPOSAL: #82517 (comment)
Tests
Offline tests
N/A — the embedded demo requires an internet connection to load the Storylane tour. The sandbox attribute is a static HTML attribute that does not depend on network state.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
N/A — change is web-only (iframe sandbox attribute)
Android: mWeb Chrome
N/A — change is web-only (iframe sandbox attribute)
iOS: Native
N/A — change is web-only (iframe sandbox attribute)
iOS: mWeb Safari
N/A — change is web-only (iframe sandbox attribute)
MacOS: Chrome / Safari