feat(clean): respect user whitelist in orphaned-data scan (#741)#744
Merged
feat(clean): respect user whitelist in orphaned-data scan (#741)#744
Conversation
Orphan detection in `clean_orphaned_app_data` and `clean_orphaned_system_services` bypassed the user-facing `WHITELIST_PATTERNS` list, so users had no way to protect individual config/cache paths from auto-removal — a real problem for apps run outside the .app bundle model (dev tools, custom builds, etc.). Adds `is_path_whitelisted` checks before `safe_clean` in the app-data scan (Claude VM + generic bundle-ID match), and filters the collected orphan list for system services before reporting counts. Existing `manage_whitelist` flow already writes to `WHITELIST_PATTERNS`, so no CLI changes are required — users can now add any absolute path or glob and the orphan scan will skip it. Interactive per-orphan checkbox UX (as described in the issue) is a follow-up once this foundation lands.
The help text in lib/core/help.sh documents the --permanent flag with a string containing "rm -rf", triggering a false positive in the security check. Add "echo " to the grep exclusion filter.
Owner
|
@sebastianbreguel thanks for respecting the whitelist in orphaned-data scans, merged and will be in the next release. |
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.
Closes part of #741.
Problem
clean_orphaned_app_dataandclean_orphaned_system_servicesbypassed the user-facingWHITELIST_PATTERNSlist, so there was no way to protect individual config/cache paths from auto-removal. Real case from the issue: apps run outside the.appbundle model (dev tools, custom builds) would have their Preferences/Caches wiped on everymo clean.Change
lib/clean/apps.sh: addis_path_whitelistedcheck beforesafe_cleanin both the Claude VM path and the generic bundle-ID orphan loop. For system services, filter the collected orphan array before reporting counts (so the "Found N" number reflects what will actually be removed).manage_whitelistalready writes toWHITELIST_PATTERNS, so users can add any absolute path or glob via the existing flow and the orphan scan now respects it.What this PR does NOT include
The issue also asks for an interactive per-orphan checkbox UX inside
mo clean --whitelist. That's a separate, larger change (dynamic scan results rendered as a TUI submenu) and I wanted to land the foundation first. Happy to open a follow-up PR once this is in and the shape feels right.Tests
Two regression tests in
tests/clean_apps.bats:No behavior change when
WHITELIST_PATTERNSis empty.