1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-08 10:54:18 +00:00

feat: harden user file handling and gate LaunchServices rebuild (#159)

- add ensure_user_dir/ensure_user_file helpers in lib/core/base.sh, including
  sudo-aware ownership correction under the invoking user’s home
- use the helpers across clean/optimize/purge/uninstall/whitelist to create
  cache and export files safely (no naked mkdir/touch), including log files and
  dry-run exports
- ensure purge stats/count files and update message caches are pre-created with
  safe permissions
- add Darwin version helpers and skip LaunchServices/dyld rebuild on macOS 15+,
  keeping the existing corruption protection for earlier versions
- guard brew cache timestamp writes and TCC permission flags with safe file
  creation to avoid root-owned artifacts
This commit is contained in:
Luke Bullimore
2025-12-26 02:54:56 +00:00
committed by GitHub
parent f838e9517d
commit 785032635a
13 changed files with 228 additions and 18 deletions

View File

@@ -75,7 +75,7 @@ scan_applications() {
local cache_ttl=86400 # 24 hours
local force_rescan="${1:-false}"
mkdir -p "$cache_dir" 2> /dev/null
ensure_user_dir "$cache_dir"
# Check if cache exists and is fresh
if [[ $force_rescan == false && -f "$cache_file" ]]; then
@@ -344,6 +344,7 @@ scan_applications() {
fi
# Save to cache (simplified - no metadata)
ensure_user_file "$cache_file"
cp "${temp_file}.sorted" "$cache_file" 2> /dev/null || true
# Return sorted file