1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-12 00:39:02 +00:00

More secure deletion and cannot delete path

This commit is contained in:
Tw93
2025-11-14 11:38:25 +08:00
parent ddef8c4bc0
commit 4f8f31444d
5 changed files with 139 additions and 10 deletions

View File

@@ -184,9 +184,8 @@ is_whitelisted() {
for existing in "${CURRENT_WHITELIST_PATTERNS[@]}"; do
local existing_expanded="${existing/#\~/$HOME}"
# Support both exact match and glob pattern match
# shellcheck disable=SC2053
if [[ "$check_pattern" == "$existing_expanded" ]] || [[ $check_pattern == $existing_expanded ]]; then
# Only use exact string match to prevent glob expansion security issues
if [[ "$check_pattern" == "$existing_expanded" ]]; then
return 0
fi
done