Skip to content

validate origin in codeembed page messages - #11775

Open
Richard Knoll (riknoll) wants to merge 1 commit into
masterfrom
dev/riknoll/validate-codeembed-origin
Open

Richard Knoll (riknoll) wants to merge 1 commit into
masterfrom
dev/riknoll/validate-codeembed-origin

Conversation

@riknoll

Copy link
Copy Markdown
Member

this is the embed that's used for the code embed iframe in shared scripts.

the only domain that ever sends messages to this page is our editor, so enforce that requirement.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The origin check throws during local serving and rejects valid renderer origins in static builds, blocking the renderready handshake and leaving code embeds blank.

1 open issue
What changed in this PR

This PR adds origin validation to the shared-script code embed page, aiming to accept messages only from the configured editor origin.

Changes:

  • Rejects messages whose origin differs from pxtConfig.targetUrl before processing rendering messages.
File Description
webapp/​public/​codeembed.html Adds an origin check to the iframe message handler.

Review effort: Balanced

Comment thread webapp/public/codeembed.html Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants