Repository navigation
feat: sandboxing - #7758
feat: sandboxing#7758
Conversation
|
Note This changelog has been baked. Any further edits will not be reflected. Pull request changelogAppAdded
Changed
DeprecatedRemovedFixed
SecurityWebsiteAddedChanged
DeprecatedRemovedFixedSecurityHostingAddedChangedDeprecatedRemovedFixedSecurity |
|
@greptileai review |
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
User-picked executables become writable
User-picked executables get write access. When a mod triggers a file dialog, handle_request_open_file_dialog exposes every path the user picks as ReadWrite, with no downgrade for executable or script extensions. The drag-and-drop path does the opposite: get_drop_permission in drag_intercept.rs forces directories and anything with an executable extension to ReadOnly, explicitly "to prevent the sandboxed process from modifying anything which could later be executed outside of the sandbox". The dialog's title, accept label, filters, and default location are all mod-controlled, so a mod can social-engineer the user into selecting an existing .bat, .ps1, or .jar (e.g. a fake "export your log" save dialog with a *.bat filter). The sandbox then gets write access to that file, the mod overwrites it, and the code runs outside the sandbox the next time the user opens it. Apply the same executable-extension downgrade to paths picked through the dialog.
[High impact] The PR changes how Minecraft processes run and how several app settings are edited. The PR needs fixes before merging, especially for the sandbox install action and game-launch regressions.
|
| JVM_ARGUMENTS.contains(&argument_name) | ||
| || LAUNCHER_MANAGED_JVM_ARGUMENTS.contains(&argument_name) | ||
| || argument.contains("${classpath}") | ||
| || argument.contains("${natives_directory}") | ||
| || argument.contains("${library_directory}") |
There was a problem hiding this comment.
Required loader arguments disappear
Filtering every argument containing ${library_directory} or ${classpath} removes loader-specific arguments too. Forge and NeoForge use these placeholders for their module path and properties such as legacyClassPath. Removing a module-path value leaves its preceding option in place, so Java reads the next option as its value and the game fails to start—even with sandboxing off.
Substitute these placeholders and remove only the options the new command actually rebuilds.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/app-lib/src/launcher/args.rs
Line: 194-198
Comment:
**Required loader arguments disappear**
Filtering every argument containing `${library_directory}` or `${classpath}` removes loader-specific arguments too. Forge and NeoForge use these placeholders for their module path and properties such as `legacyClassPath`. Removing a module-path value leaves its preceding option in place, so Java reads the next option as its value and the game fails to start—even with sandboxing off.
Substitute these placeholders and remove only the options the new command actually rebuilds.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| #[inline] | ||
| pub fn instance_data_dir(&self) -> PathBuf { | ||
| self.config_dir.join(INSTANCE_DATA_FOLDER_NAME) |
There was a problem hiding this comment.
Persistent game data stays behind
The new instance-data folder is missing from MOVED_APP_DIRECTORIES. After the user moves the app directory, instance_data_dir() points under the new root, but the move copies only its existing six folders. Minecraft gets a fresh home and cannot find the mod data saved in the old location.
Include this folder in the copy and path-mapping work.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/app-lib/src/state/dirs.rs
Line: 185-187
Comment:
**Persistent game data stays behind**
The new `instance-data` folder is missing from `MOVED_APP_DIRECTORIES`. After the user moves the app directory, `instance_data_dir()` points under the new root, but the move copies only its existing six folders. Minecraft gets a fresh home and cannot find the mod data saved in the old location.
Include this folder in the copy and path-mapping work.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| if let Err(errno) = rustix::fs::linkat( | ||
| old_dirfd, | ||
| &*old_path, | ||
| new_dirfd, | ||
| newname, | ||
| AtFlags::SYMLINK_NOFOLLOW, |
There was a problem hiding this comment.
Linux linkat does not accept AT_SYMLINK_NOFOLLOW; not following the source link is already its default. Passing AtFlags::SYMLINK_NOFOLLOW makes every hard-link request through this file-sharing filesystem fail with EINVAL.
Pass empty flags so mods can create hard links in shared folders.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/modrinth-sandbox/src/backend/linux/file_sharing.rs
Line: 2180-2185
Comment:
**Shared-folder hard links fail**
Linux `linkat` does not accept `AT_SYMLINK_NOFOLLOW`; not following the source link is already its default. Passing `AtFlags::SYMLINK_NOFOLLOW` makes every hard-link request through this file-sharing filesystem fail with `EINVAL`.
Pass empty flags so mods can create hard links in shared folders.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.d81e90c to
94fdde4
Compare
…ile. Only block access when the file doesn't exist
Uh oh!
There was an error while loading. Please reload this page.