Fix HIGH priority issues: library exit, unquoted paths, and globs

Fixed multiple HIGH severity issues found by QA scan:

1. Library exit usage (lib/http-attack-analyzer.sh):
   - Changed exit 1 to return 1
   - Libraries should return, not exit (would terminate caller)

2. Unquoted path expansions (9 fixes):
   - cleanup-toolkit-data.sh: Quoted $pattern in ls/rm commands
   - hardware-health-check.sh: Quoted /sys/block/$disk/queue paths
   - plesk-helpers.sh: Quoted /var/qmail/mailnames/$domain path
   - Prevents breakage with paths containing spaces

3. Unquoted globs in rm commands (3 fixes):
   - erase-toolkit-traces.sh: Quoted glob patterns
   - Prevents unintended file deletion from glob expansion

All changes improve robustness and prevent edge case failures.
This commit is contained in:
cschantz
2026-01-02 16:39:57 -05:00
parent a5d61ea7d8
commit 8f6cb6e91c
5 changed files with 20 additions and 20 deletions
+2 -2
View File
@@ -1425,8 +1425,8 @@ check_kernel_parameters() {
local disks=$(lsblk -nd -o NAME,TYPE 2>/dev/null | awk '$2=="disk" {print $1}')
if [ -n "$disks" ]; then
while IFS= read -r disk; do
local scheduler=$(cat /sys/block/$disk/queue/scheduler 2>/dev/null | grep -oP '\[\K[^\]]+')
local rotational=$(cat /sys/block/$disk/queue/rotational 2>/dev/null)
local scheduler=$(cat "/sys/block/$disk/queue/scheduler" 2>/dev/null | grep -oP '\[\K[^\]]+')
local rotational=$(cat "/sys/block/$disk/queue/rotational" 2>/dev/null)
if [ -n "$scheduler" ] && [ -n "$rotational" ]; then
# Check if scheduler is appropriate for disk type