feat: Allow hosts to customize app iframe sandbox permissions#204
Open
matsjfunke wants to merge 6 commits into
Open
feat: Allow hosts to customize app iframe sandbox permissions#204matsjfunke wants to merge 6 commits into
matsjfunke wants to merge 6 commits into
Conversation
… StrictMode unhandled rejection Co-authored-by: claude <noreply@anthropic.com>
…ready message with jsdom contentWindow mock
…idate SandboxCancelRef documentation
Co-authored-by: Cursor <cursoragent@cursor.com>
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.
TLDR
IMO defaulting to allow-same-origin is fine if you host your iframe on a separate, cookieless sandbox origin. The issue is when the sandbox proxy is served from the same origin as the host app: allow-scripts + allow-same-origin lets untrusted MCP app HTML execute with host-origin privileges. This change makes sandbox.permissions actually apply, so hosts can opt into stricter isolation, e.g. allow-scripts allow-forms, without forking the client.
Summary
sandbox.permissionsthroughAppFrameinto the sandbox proxy iframe instead of always using the default sandbox attribute.mcp-apps.mdthat broke docs builds.After:
Advantage: hosts can now remove allow-same-origin for same-origin sandbox proxies, so untrusted MCP app HTML can still run scripts but no longer gets the host app’s origin privileges.