Fix ESCAPE issues in rate anomaly detector
- Added -- separator to awk commands (3 fixes at lines 36-38) - Prevents filename injection attacks 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,9 +33,9 @@ detect_rate_anomaly() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Count requests in different time windows
|
# Count requests in different time windows
|
||||||
local req_1sec=$(awk -v cutoff="$((current_time - 1))" '$1 > cutoff' "$rate_file" 2>/dev/null | wc -l)
|
local req_1sec=$(awk -v cutoff="$((current_time - 1))" '$1 > cutoff' -- "$rate_file" 2>/dev/null | wc -l)
|
||||||
local req_10sec=$(awk -v cutoff="$((current_time - 10))" '$1 > cutoff' "$rate_file" 2>/dev/null | wc -l)
|
local req_10sec=$(awk -v cutoff="$((current_time - 10))" '$1 > cutoff' -- "$rate_file" 2>/dev/null | wc -l)
|
||||||
local req_60sec=$(awk -v cutoff="$((current_time - 60))" '$1 > cutoff' "$rate_file" 2>/dev/null | wc -l)
|
local req_60sec=$(awk -v cutoff="$((current_time - 60))" '$1 > cutoff' -- "$rate_file" 2>/dev/null | wc -l)
|
||||||
|
|
||||||
local anomaly_score=0
|
local anomaly_score=0
|
||||||
local anomaly_type="NORMAL"
|
local anomaly_type="NORMAL"
|
||||||
|
|||||||
Reference in New Issue
Block a user