Repository navigation
fix(macos): Copy menu item works; Seatbelt profile uses real, escaped paths (#1590) - #1703
Merged
Merged
Conversation
…nd escapes them (#1590)
3 tasks
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.
Refs #1590 (items 1 and 2, and the escaping from item 3; narrowing the profile is not in this PR).
Copy menu item (
querya_platform_menu_bar.dart): it wasconst PlatformMenuItem(label: 'Copy', ...)with noonSelected, which Flutter draws disabled. It now invokesCopySelectionTextIntent.copyon the focused widget, the way Cut, Paste and Select All already do.Seatbelt paths (
sandbox_launch_command.dart): the scratch directory is underDirectory.systemTemp(/var/folders/...), and/varis a link to/private/var. Seatbelt matchessubpathagainst the real path, so(allow file-write* (subpath "/var/folders/..."))would never match and the extension could not write its scratch. The macOS command now resolves the scratch and extension roots withresolveSymbolicLinksSyncbefore building the profile (a path that does not exist is kept as given).Escaping:
scratchPathandextensionRootwere put into the profile between quotes as-is; a"in a path could end the string and add a rule. They now go throughseatbeltString, which escapes\and".Not done: narrowing
(allow mach-lookup),(allow process*)and thefile-read*outside/Users. A too-narrow profile stops extension processes from starting, and I have no Mac to find what they really need, so this stays in #1590. The path fix is also unverified on a Mac (the issue says items 1-2 need confirmation there); the logic is covered by tests on Linux.Tests: a quote and a backslash in the scratch path are escaped and an injected rule in the extension root stays inside its string; a symlinked scratch and extension root appear in the profile by their real path; a missing path is kept.