[Analyze 2718] Fix wizards shiny source validation - #3017
Open
jerome-ng wants to merge 1 commit into
Open
Conversation
jerome-ng
requested review from
LSriragavan,
brandantck,
khairul-syazwan,
maggie-li-yd and
p-hoffmann
as code owners
July 29, 2026 08:50
3 tasks
khairul-syazwan
approved these changes
Jul 29, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes postMessage source validation for the Wizards-embedded ShinyLive dashboard so readiness/error events are accepted from the expected frame(s) and auth context is sent back to the correct trusted window.
Changes:
- Adds a resolver to accept
SHINYLIVE_READYfrom either the outer ShinyLive iframe or its direct dashboard child iframe. - Targets
AUTH_TOKENpostMessage responses to the exact window that emittedSHINYLIVE_READY, while continuing to validateevent.origin. - Adds unit tests covering accepted/rejected message-source scenarios.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| plugins/ui/apps/wizards/src/utils/shinyDashboardContext.ts | Adds resolveShinyDashboardMessageSource to validate/resolve the trusted message sender window. |
| plugins/ui/apps/wizards/src/utils/tests/shinyDashboardContext.test.ts | Adds tests for allowed and rejected message sources (outer iframe, direct child, unrelated/deeper frames). |
| plugins/ui/apps/wizards/src/components/ShinyDashboardIframe.tsx | Uses the resolver to validate message sources and targets AUTH_TOKEN to the readiness sender window. |
Comment on lines
90
to
92
| } else if (event.data?.type === "SHINYLIVE_ERROR") { | ||
| setError("The dashboard reported an error. Please try opening it again."); | ||
| } |
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.
Summary
ShinyLive runs the dashboard inside a child iframe. The Wizards host previously accepted messages only from the outer iframe, so it rejected the dashboard’s
SHINYLIVE_READYevent and sent authentication context to the wrong window.This change:
AUTH_TOKENto the exact trusted sender.Related to #2718. Follow-up to #2897.