1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 17:24:45 +00:00
Commit Graph

19 Commits

Author SHA1 Message Date
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
d3f1cdd834 fix(security): allow Firefox ..files directories in path validation
Fixes #263

- Change regex from \.\. to (^|/)\.\.(/|$) to only match path components
- Firefox uses ..files suffix in IndexedDB dirs (e.g., name..files)
- Still blocks actual traversal: /tmp/../etc
- Added test cases for Firefox compatibility
- All 16 tests passing
2026-01-06 09:51:34 +08:00
Tw93
33a77fecef Merge pull request #254 from JackPhallen/chore/remove-unnecessary-command-check
chore: Do not check if should_protect_path exists
2026-01-05 14:54:27 +08:00
Jack Phallen
f21a1339a7 chore: Do not check if should_protect_path exists
should_protect_path will always be available as it comes from common.sh.
This check adds a lot of overhead as it runs on every file.
2026-01-04 21:33:39 -05:00
Tw93
b044fa3e60 chore: auto format code 2026-01-04 09:52:09 +00:00
Tw93
cd5baf9a72 feat(debug): enhance file removal with detailed debug output
- Add file metadata logging in safe_remove() and safe_sudo_remove()
- Log file type, size, and age when in debug mode
- Support both dry-run and actual removal scenarios
- Part of GitHub issue #242 implementation
2026-01-04 17:30:36 +08:00
Tw93
bb49ec3170 fix: Improve shell script robustness by adding variable validation and safer du output parsing. 2025-12-30 18:07:48 +08:00
Tw93
34d202eb01 fix: resolve syntax error in size calculation (Issue #203)
- Add numeric validation for size variables in safe_clean()
- Fix get_path_size_kb() to handle non-numeric du output
- Display custom whitelist patterns in dry-run output (Issue #206)
2025-12-30 14:38:02 +08:00
Tw93
8666c740cb workflow 2025-12-29 15:15:52 +08:00
Tw93
694c55f73b fix: implement layered error tolerance and accurate cleanup reporting (#175 #176 #180)
- Fix safe_remove set -e trap in command substitution
  - Fix has_full_disk_access false positives and unknown state handling
  - Use set +e in perform_cleanup for graceful degradation
  - Track removal failures and only count actually deleted items (#180)
  - Add "Skipped X items (permission denied or in use)" notification
  - Improve spinner reliability with cooperative stop mechanism (#175)
2025-12-29 14:27:47 +08:00
Tw93
50e47a3cd9 chore: bump version to 1.15.3 and update the security audit report following core protection and file operation refinements. 2025-12-28 21:30:39 +08:00
Tw93
66ad3b34ee chore: auto format code 2025-12-28 11:39:34 +00:00
Tw93
faac42cb62 Improve performance and process handling 2025-12-28 19:37:42 +08:00
Tw93
7e3daabcfb feat: Enhance file deletion safety with path protection, streamline update prompts, and remove automated Homebrew update checks. 2025-12-18 20:17:03 +08:00
Tw93
79e40b9c91 docs: Improve clarity and conciseness of comments and documentation 2025-12-18 17:35:54 +08:00
Tw93
af03452f6d feat: Enhance clean and optimize operations with new configuration constants 2025-12-18 17:02:04 +08:00
Tw93
88c5f92ac4 format 2025-12-08 18:59:52 +08:00
Tw93
03385c98bc Safety reinforcement 2025-12-08 17:50:46 +08:00
Tw93
80e3be710b Restructure common split content 2025-12-08 15:33:52 +08:00