Skip to content

enforce origin checks between editor and content iframe - #164

Merged
preaction merged 1 commit into
Yancy-app:masterfrom
uniejo:fix-editor-iframe-origin
Oct 10, 2026
Merged

preaction merged 1 commit into
Yancy-app:masterfrom
uniejo:fix-editor-iframe-origin

Conversation

@uniejo

@uniejo uniejo commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

The iframe logged disallowed origins but still accepted their editor port, so any site framing a page could drive the content editor. The origin check also used unanchored matching, so a string like "http://localhost:3000" matched "http://localhost:3000.evil.com".

  • Ignore messages that are not a Yancy.init request with a port
  • Stop handling messages from origins that are not allowed
  • Compare string origins exactly, and require RegExps to match the whole origin
  • Default allowOrigins to the page's own origin, and set it even when window.Yancy already exists
  • Ignore editor commands that are not editor chain methods
  • Send the editor port only to the site origin instead of "*", so a page the iframe navigated to can not receive it

The iframe logged disallowed origins but still accepted their editor
port, so any site framing a page could drive the content editor. The
origin check also used unanchored matching, so a string like
"http://localhost:3000" matched "http://localhost:3000.evil.com".

- Ignore messages that are not a Yancy.init request with a port
- Stop handling messages from origins that are not allowed
- Compare string origins exactly, and require RegExps to match the
  whole origin
- Default allowOrigins to the page's own origin, and set it even when
  window.Yancy already exists
- Ignore editor commands that are not editor chain methods
- Send the editor port only to the site origin instead of "*", so a
  page the iframe navigated to can not receive it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@preaction

Copy link
Copy Markdown
Collaborator

Thanks!

@preaction
preaction merged commit da858e5 into Yancy-app:master Oct 10, 2026
1 check failed
@uniejo
uniejo deleted the fix-editor-iframe-origin branch October 12, 2026 08:27
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.

2 participants