Allow-list bypass vulnerability due to incorrect path prefix matching without trailing slash.
Raw Developer Origin & Technical Request
GitHub Issue
Apr 16, 2026
### Summary
`CleaningEngine.isSafeToDelete` validates paths with `resolvedPath.hasPrefix(root)` — no separator. Sibling directories that merely start with an allow-listed name pass the check.
### Location
`PureMac/Services/CleaningEngine.swift` lines 111-139
### Evidence
10/10 adversarial paths pass the current check:
```
/tmp → accepts /tmpfoo/victim.secret
~/Library/Caches → accepts ~/Library/Caches-evil/payload
~/Library/LaunchAgents → accepts ~/Library/LaunchAgentsEvil/z.plist
~/Documents → accepts ~/Documents2/secret
~/Desktop → accepts ~/Desktopfoo/thing
~/Downloads → accepts ~/Downloadsfoo/x
~/.Trash → accepts ~/.Trash2/x
/private/var/tmp → accepts /private/var/tmpstealer/payload
/Library/Caches → accepts /Library/CachesX/evil
```
### Impact
Any cleanable item whose emitted path matches a sibling-of-root (via independent bugs, TOCTOU, or env-steering of `brew --cache`) is silently deleted outside the intended directories.
### Fix
```swift
// CleaningEngine.swift, isSafeToDelete(resolvedPath:)
let normalized = (resolvedPath as NSString).standardizingPath
return allowedRoots.contains { root in
let rootWithSeparator = root.hasSuffix("/") ? root : root + "/"
return normalized.hasPrefix(rootWithSeparator)
}
```
### Test
- Unit: each adversarial path above → `false`.
- Regression: real cache paths like `~/Library/Caches/com.microsoft.teams` → `true`.
Developer Debate & Comments
No active discussions extracted for this entry yet.
Adjacent Repository Pain Points
Other highly discussed features and pain points extracted from momenbasel/PureMac.
Frequently Asked Questions
Market intelligence mapped to Allow-list bypass vulnerability due to incorrect path prefix matching without trailing slash..
What problem does Allow-list bypass vulnerability due to incorrect path prefix matching without trailing slash. solve?
Which technical concepts are associated with Allow-list bypass vulnerability due to incorrect path prefix matching without trailing slash.?
Engagement Signals
Cross-Market Term Frequency
Quantifies the cross-market adoption of foundational terms like root and isSafeToDelete by tracking occurrence frequency across active SaaS architectures and enterprise developer debates.
SaaS Metrics