From 0be6dbe5518c332b14ed020efb677207c116e01f Mon Sep 17 00:00:00 2001 From: cschantz Date: Tue, 3 Feb 2026 19:56:12 -0500 Subject: [PATCH] Fix: Remove ternary operators causing syntax errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: Bash arithmetic expansion does not support ternary operators Lines 1789-1791 used: base_risk=$((base_risk < 2 ? base_risk : base_risk - 1)) This caused syntax error: "error token is..." Fix: Replace ternary operators with proper conditional logic: - [ "$has_tty" -eq 1 ] && [ "$base_risk" -gt 1 ] && base_risk=$((base_risk - 1)) This achieves the same result (prevent risk from going below 1) without using unsupported ternary syntax. Testing: ✓ Syntax validation passed ✓ Script runs without errors Co-Authored-By: Claude Sonnet 4.5 --- modules/security/suspicious-login-monitor.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/security/suspicious-login-monitor.sh b/modules/security/suspicious-login-monitor.sh index 1e5633e..2d3f090 100755 --- a/modules/security/suspicious-login-monitor.sh +++ b/modules/security/suspicious-login-monitor.sh @@ -1786,9 +1786,9 @@ check_recent_password_changes() { local base_risk=5 [ "$admin_active" -eq 1 ] && base_risk=2 [ "$safe_window" -eq 1 ] && base_risk=2 - [ "$has_tty" -eq 1 ] && base_risk=$((base_risk < 2 ? base_risk : base_risk - 1)) - [ "$login_recent" -eq 1 ] && base_risk=$((base_risk < 2 ? base_risk : base_risk - 1)) - [ "$in_maintenance" -eq 1 ] && base_risk=$((base_risk < 2 ? base_risk : base_risk - 1)) + [ "$has_tty" -eq 1 ] && [ "$base_risk" -gt 1 ] && base_risk=$((base_risk - 1)) + [ "$login_recent" -eq 1 ] && [ "$base_risk" -gt 1 ] && base_risk=$((base_risk - 1)) + [ "$in_maintenance" -eq 1 ] && [ "$base_risk" -gt 1 ] && base_risk=$((base_risk - 1)) risk=$((risk + base_risk)) details="${details}Single-user:$filtered_users " else