Skip to content

Add sandbox attribute to extension iframe in DevTools. - #9967

Open
johnpryan wants to merge 3 commits into
flutter:masterfrom
johnpryan:iframe-security
Open

Add sandbox attribute to extension iframe in DevTools.#9967
johnpryan wants to merge 3 commits into
flutter:masterfrom
johnpryan:iframe-security

Conversation

@johnpryan

Copy link
Copy Markdown
Contributor

This change grants these permissions:

  • allow-scripts: enables extension JS / Wasm execution.
  • allow-forms: permits standard form interactions.
  • allow-downloads: allows extensions to export files/logs.
  • allow-popups & allow-popups-to-escape-sandbox: allows opening external links.

This does not grant allow-same-origin permission, so extensions can't access the parent window's DOM, cookies, or local storage.

This change grants these permissions:
- `allow-scripts`: enables extension JS / Wasm execution.
- `allow-forms`: permits standard form interactions.
- `allow-downloads`: allows extensions to export files/logs.
- `allow-popups` & `allow-popups-to-escape-sandbox`: allows opening
   external links.

This does not grant `allow-same-origin` permission, so extensions can't
access the parent window's DOM, cookies, or local storage.
@johnpryan
johnpryan marked this pull request as ready for review August 18, 2026 20:07
@johnpryan
johnpryan requested a review from a team as a code owner August 18, 2026 20:07
@johnpryan
johnpryan requested review from bkonyi and removed request for a team August 18, 2026 20:07

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces iframe sandboxing for embedded DevTools extensions to enforce origin isolation, and updates the release notes. The reviewer recommended extracting the raw sandbox configuration string into a descriptive named constant to avoid magic strings, in accordance with the repository style guide.

Comment thread packages/devtools_app/lib/src/extensions/embedded/_controller_web.dart Outdated
@srawlins

Copy link
Copy Markdown
Contributor

Does this fix a specific issue that's been opened?

@johnpryan

Copy link
Copy Markdown
Contributor Author

See b/535724008

@kenzieschmoll kenzieschmoll left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How was this tested? The iFrame does need to talk back and forth with the parent for the DevTools extension API, so just want to make sure everything here still works.

@johnpryan

Copy link
Copy Markdown
Contributor Author

This should still allow postMessage communication with DevTools, but I only tested this with the foo_ext mock package, I will test this with a real-world package and let you know if anything stops working.

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