Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ String _debugExtensionPlaceholderHtml(String name) {
''';
}

/// The sandbox permissions granted to embedded extension iframes.
///
/// Restricts the extension from accessing same-origin resources such as
/// the parent window DOM, cookies, or local storage, while allowing
/// javascript execution, forms, downloads, and popup windows.
const _extensionSandboxRules =
'allow-scripts allow-forms allow-downloads allow-popups allow-popups-to-escape-sandbox';

class EmbeddedExtensionControllerImpl extends EmbeddedExtensionController
with AutoDisposeControllerMixin {
EmbeddedExtensionControllerImpl(super.extensionConfig);
Expand Down Expand Up @@ -123,7 +131,8 @@ class EmbeddedExtensionControllerImpl extends EmbeddedExtensionController
// This url is safe because we built it ourselves and it does not include
// any user input.
..src = extensionUrl
..allow = 'usb';
..allow = 'usb'
..sandbox.value = _extensionSandboxRules;
_extensionIFrame.style
..border = 'none'
..height = '100%'
Expand Down
2 changes: 2 additions & 0 deletions packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ TODO: Remove this section if there are not any updates.

* Hide the DevTools extensions menu button in single-screen embedded mode (`EmbedMode.embedOne`) on standard screens.
[#8507](https://github.com/flutter/devtools/issues/8507)
* Added iframe sandboxing for embedded DevTools extensions to enforce origin
isolation. [#9967](https://github.com/flutter/devtools/pull/9967)

## Advanced developer mode updates

Expand Down
Loading