Uninstaller: validate app-bundle deletion + refuse protected apps#113
Open
iliyami wants to merge 1 commit into
Open
Uninstaller: validate app-bundle deletion + refuse protected apps#113iliyami wants to merge 1 commit into
iliyami wants to merge 1 commit into
Conversation
Security review found the uninstaller trashed the app bundle with a raw `try? FileManager.default.trashItem(...)` that skipped SafetyGuard, never re-checked protected apps (only the UI hid the button), and swallowed errors. Note SafetyGuard.validatePath is path-based and can't catch a protected *app* (protection is by bundle id), so that guard has to be explicit. - Extract AppUninstaller.plan(): refuses protected apps (bundle-id check) and builds a clean plan that includes the bundle as a FileItem. - uninstall() now routes the bundle through the same validated, logged, trash-first CleaningEngine as its leftovers (no more raw trashItem), and surfaces failures in an alert instead of discarding the result. - Regression tests: protected app is refused; the bundle is routed through the engine and always selected; leftovers are preserved. Bump to 1.16.2.
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.
Second finding from the security review. The uninstaller's app-bundle deletion was the one delete path that skipped the app's own safety rails.
Findings (deep dive)
UninstallerView.uninstall()trashed the bundle withtry? FileManager.default.trashItem(at: app.path, ...): novalidatePath, no protected-app re-check, error swallowed. (The associated files already went through the validated engine; only the bundle was raw.)SafetyGuard.validatePathis path-based (protected paths / SIP / symlink), whileisProtectedAppis bundle-id based. So neither validatePath nor routing through the engine protects a protected app, that check must be explicit. Today it was only the UI hiding the button.Fix
AppUninstaller.plan(): refuses protected apps (bundle-id) and returns a clean plan that includes the bundle as aFileItem.uninstall()routes the bundle through the same validated/logged/trash-firstCleaningEngineas its leftovers, and surfaces failures in an alert instead of discarding the result with_ =.Testing (TDD)
com.apple.finder) is refused; the bundle is routed through the engine and always selected; leftovers preserved.check-version-sync(1.16.2),swift buildclean,swift test612 passed / 3 skipped / 0 failures.Both security-review findings (this + the shredder #112) are now addressed.