fix: resolve subshell bug in whitelist-check and reduce output noise (#1231)

- Remove pipe before while loop to fix subshell issue where violation
  arrays were always empty (violations detected but never reported)
- Replace per-file "Checking:" output with progress dots every 10 files
- Add summary showing total files checked
This commit is contained in:
LearningCircuit
2025-12-04 23:23:06 +01:00
committed by GitHub
parent a123f72cb2
commit 04246669c3

View File

@@ -82,6 +82,7 @@ fi
echo "🔍 Running comprehensive security checks..."
echo ""
FILES_CHECKED=0
WHITELIST_VIOLATIONS=()
LARGE_FILES=()
SECRET_VIOLATIONS=()
@@ -96,7 +97,7 @@ HARDCODED_IP_VIOLATIONS=()
SUSPICIOUS_FILETYPE_VIOLATIONS=()
# Use improved file processing that handles spaces and special characters
printf '%s\n' "$CHANGED_FILES" | while IFS= read -r file; do
while IFS= read -r file; do
[ -z "$file" ] && continue
# Skip deleted files
@@ -104,7 +105,10 @@ if [ ! -f "$file" ]; then
continue
fi
echo "Checking: $file"
FILES_CHECKED=$((FILES_CHECKED + 1))
if [ $((FILES_CHECKED % 10)) -eq 0 ]; then
printf "."
fi
# 1. Whitelist check
ALLOWED=false
@@ -310,6 +314,10 @@ fi
fi
done <<< "$CHANGED_FILES"
echo ""
echo "✓ Checked $FILES_CHECKED files"
echo ""
# Report all violations with detailed explanations
echo "📊 Security scan completed. Analyzing results..."
echo "📋 Summary of findings:"