1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 15:39:42 +00:00
Commit Graph

41 Commits

Author SHA1 Message Date
Tw93
cde39aaeb2 feat(clean): add large file review and unify warnings 2026-01-22 20:15:13 +08:00
Tw93
9d824d0ad2 fix: restore uninstall traps and remove dead search key 2026-01-22 17:45:53 +08:00
Tw93
3f85c8238f Use gray color for warning icons to reduce visual noise 2026-01-20 15:07:37 +08:00
Tw93
d044b2876e Fix unable to uninstall data-protected apps like Clash Party
Previously, apps matching DATA_PROTECTED_BUNDLES patterns (VPNs, dev tools, etc.)
could not be uninstalled because should_protect_path blocked their deletion.
Now use MOLE_UNINSTALL_MODE to distinguish between cleanup and explicit uninstall,
allowing users to remove these apps when they choose to while still protecting
their data during normal cleanup operations.

Also allow deletion of installer receipts in /private/var/db/receipts/.
2026-01-20 11:54:17 +08:00
Tw93
127e589291 Fix test error case 2026-01-20 10:26:13 +08:00
Tw93
cec385efc7 chore: auto format code 2026-01-19 08:54:45 +00:00
Tw93
d25c9f7637 refactor(uninstall): remove search and optimize scan performance
- Remove complex search/filter feature from menu (simplify UX)
  - Optimize Homebrew cask detection (only check Caskroom symlinks)
  - Cache whoami outside loop, use bash parameter expansion
  - Fix spinner overlap with error messages
  - Add trap for Ctrl+C cleanup
  - Use ICON_ERROR for failure messages
2026-01-19 16:53:51 +08:00
Tw93
fe296de814 chore: auto format code 2026-01-17 01:53:40 +00:00
Tw93
060c48c48d refactor: enhance uninstall safety and fix dock removal
- Add symlink/bundle_id/BOM validation to prevent injection attacks
- Fix Dock removal for /Applications symlink (use pwd not pwd -P)
- Fix brew uninstall test hanging (skip sudo in non-interactive mode)
- Remove unused SENSITIVE_DATA_REGEX
2026-01-17 09:49:42 +08:00
Tw93
12cacaa6cc refactor: enhance pattern detection and symlink safety
- Expand sensitive data patterns (credentials, cloud configs, media folders)
- Add symlink target validation in path deletion checks
- Remove shared Gradle cache from Android Studio cleanup
2026-01-17 09:09:11 +08:00
Tw93
7a46aa04db security: harden BOM processing and LaunchAgents detection
- Add path traversal protection in BOM receipt parsing
- Remove invalid ~/Library/LaunchDaemons path references
- Strengthen LaunchAgents matching (min 5 chars, exclude com.apple.*)
- Add 300s timeout to brew cask uninstall to prevent hangs
Addresses security review findings from V1.21.0 audit.
2026-01-17 09:08:41 +08:00
Tw93
a7ea5d94a0 chore: auto format code 2026-01-16 07:28:58 +00:00
Tw93
ffa46b03ee fix(uninstall): resolve hang during brew uninstall by exposing output and ensuring sudo 2026-01-16 12:54:21 +08:00
Tw93
60ee0e1f9c feat(uninstall): add progress spinner for brew autoremove
- Show 'Checking brew dependencies...' spinner while running brew autoremove
- Prevents user confusion when brew cleanup takes time after uninstall
- Improves UX by providing visual feedback during dependency cleanup
2026-01-16 10:26:46 +08:00
Tw93
2cecb881a9 docs: update SECURITY_AUDIT for receipt processing safety
- Document /private path exceptions for safe cleanup
- Add receipt file filtering details
- Auto-format shell scripts (shellcheck)
2026-01-15 21:02:13 +08:00
Tw93
7dc854cf30 fix(uninstall): enhance receipt file processing safety and prevent system file deletion
CRITICAL SECURITY FIX

Enhanced the receipt file parsing in uninstall operations to prevent
accidental deletion of critical system files while maintaining deep
cleanup capabilities.

Changes:
- Tightened whitelist in find_app_receipt_files() to exclude /Users/*,
  /usr/*, and /opt/* broad patterns
- Added explicit blacklist for /private/* with safe exceptions for
  logs, temp files, and diagnostic data
- Integrated should_protect_path() check for additional protection
- Added file deduplication with sort -u to prevent duplicate deletions
- Removed dry-run feature from batch uninstall (unused entry point)

Path Protection:
 Blocked: /etc/passwd, /var/db/*, /private/etc/*, all system binaries
 Allowed: /Applications/*, specific /Library/* subdirs, safe /private/* paths
 Additional: Keychain files, system preferences via should_protect_path()

This fixes a critical security issue where parsing .bom receipt files
could result in deletion of system files like /etc/passwd and /var/db/*,
leading to system corruption and data loss.

Affects: V1.12.14 and later versions
Testing: Validated against critical system paths, all blocked correctly
2026-01-15 21:01:11 +08:00
Tw93
30547c9c4c refactor(uninstall): enhance login item removal and brew UI
- Escape quotes/backslashes in app names for AppleScript safety
- Silence osascript stdout to prevent output noise
- Capture brew uninstall output to avoid spinner corruption
- Log brew errors to debug_log for troubleshooting
2026-01-15 15:13:51 +08:00
Tw93
9a9e6c780f Merge pull request #318 from NanmiCoder/main
fix: resolve password input issue with special characters
2026-01-15 14:34:25 +08:00
Tw93
7b14a3abd8 feat(uninstall): enhance brew UX and auto-cleanup dependencies
- Auto-run 'brew autoremove' after uninstalling casks
- Fix spinner interference during brew operations
- Add safety check for cask token detection
2026-01-15 14:31:36 +08:00
Tw93
dbf036fdaa refactor: simplify brew.sh with native macOS tools
- resolve_path: use realpath (macOS 12.3+) instead of python3/perl
- deduplicate tokens with sort -u instead of manual loop
- reuse _extract_cask_token_from_path in symlink check
- simplify brew_uninstall_cask boolean logic

Reduces 88 lines (281 → 193)
2026-01-15 14:05:42 +08:00
Tw93
3b517c7a6b Merge branch 'dev' into fix/harden-brew-uninstall 2026-01-15 14:00:20 +08:00
Tw93
518b57024c chore: auto format code 2026-01-15 03:42:35 +00:00
Tw93
c34d91b36f feat: enhance uninstall with launch items and login items cleanup
- Add automatic cleanup of LaunchAgents/Daemons (Issue #315)
- Support both system and user-level launch paths
- Add Login Items cleanup (fixing broken entries like CodexBar)
- Improve Homebrew uninstall logging visibility
- Update security audit and tests
2026-01-15 11:39:33 +08:00
Jack Phallen
d884a268e8 fix(uninstall): Harden brew uninstall 2026-01-14 09:17:41 -05:00
Tw93
62cfafd7da Tighten dock removal and add brew uninstall fallback 2026-01-14 14:09:08 +08:00
Tw93
6b594c7d69 feat: add Homebrew integration and optimize UI performance
- Add Homebrew cask detection and use 'brew uninstall --cask' for proper cleanup
  - Add real-time progress feedback during uninstallation
  - Optimize scroll performance by only redrawing visible items
  - Replace Python-based Dock removal with PlistBuddy for better compatibility
  - Add comprehensive tests for Homebrew functionality

  Fixes #306
2026-01-13 10:44:48 +08:00
Tw93
9aa569cbb6 feat: Enhance clean, optimize, analyze, and status commands, and update security audit documentation. 2025-12-31 16:23:31 +08:00
Tw93
4aaab78985 chore: auto format code 2025-12-25 03:27:51 +00:00
Tw93
952b2eea61 fix: Enhance uninstall robustness with base64
compatibility and cleanup improvements

- Fix field count
  mismatch and base64 BSD/GNU compatibility
  - Add sensitive data detection and macOS defaults cleanup
  - Improve error handling and add compatibility tests
2025-12-25 11:24:12 +08:00
Tw93
a667a1a777 feat: Bump version to 1.13.5, enhance show_version output, optimize software update checks, and add Touch ID for sudo as a security fix. 2025-12-17 11:56:39 +08:00
Tw93
be1027f9c3 refine sudo requirement checks for uninstallation. 2025-12-17 10:37:03 +08:00
Tw93
88c5f92ac4 format 2025-12-08 18:59:52 +08:00
Tw93
2386701897 Fix search problems and best practices 2025-12-08 17:40:54 +08:00
Tw93
3b59920bab Simplify the debug code 2025-12-06 12:40:07 +08:00
Tw93
b939442e92 Support debug 2025-12-05 17:16:46 +08:00
Tw93
5761fd87c8 Simpler and faster 2025-12-05 14:21:18 +08:00
Tw93
a92d352376 Safety and Reliability Improvements 2025-12-04 15:06:45 +08:00
Tw93
443b59d9c7 Grammar check and optimization 2025-12-02 17:02:14 +08:00
Tw93
bb50a345b6 optimize code structure and reduce duplication 2025-12-02 15:24:19 +08:00
Tw93
8cdf583d85 Uniform color specifications 2025-12-02 14:45:48 +08:00
Tw93
61644caf92 Uninstall supports multi-level directory search 2025-12-02 10:58:40 +08:00