Reject negative manual ban durations

This commit is contained in:
Brandon McGinty (chatgpt)
2026-08-09 14:29:15 -04:00
committed by Brandon McGinty
parent 0e9e495a8f
commit 51d62c3acb
3 changed files with 29 additions and 4 deletions
+12
View File
@@ -65,6 +65,18 @@ func TestPermissionList(t *testing.T) {
}
}
// Regression: negative manual-ban minutes were cast to an unsigned protocol
// duration, turning a rejected short ban into an extremely long one.
func TestManualBanDurationRejectsNegativeMinutes(t *testing.T) {
if _, err := manualBanDuration("-1"); err == nil {
t.Fatal("negative duration was accepted")
}
got, err := manualBanDuration("15")
if err != nil || got != 15*60*1000000000 {
t.Fatalf("got %v, %v", got, err)
}
}
func TestAdminEscapeInputs(t *testing.T) {
if !isAdminEscapeKey(uiterm.KeyEsc) {
t.Fatal("expected escape key to close admin menu")