From ad36dd177544e05c3234694e6bcefaafb5a1e4f7 Mon Sep 17 00:00:00 2001 From: clawbot <35+clawbot@noreply.example.org> Date: Wed, 11 Nov 2026 01:09:22 +0100 Subject: [PATCH] Discriminator tests: stop timing the sixteen-thousand-cookie requests (closes #308) The two tests that send sixteen thousand cookies checked the answer time on the wall clock, which a busy host can push past the bound. They no longer check how long the answer took. The first is renamed to say what it checks: a 431 before the Core Rule Set reads the request. TestARefusedRequestDoesNotWaitForASlowGeoJS still checks that a refusal over the header limits waits on nothing. Model: opus-5-5 --- internal/discriminator/answertime_test.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/internal/discriminator/answertime_test.go b/internal/discriminator/answertime_test.go index 684a8d6..388fd0b 100644 --- a/internal/discriminator/answertime_test.go +++ b/internal/discriminator/answertime_test.go @@ -67,20 +67,15 @@ func fillHeaders(req *http.Request, total int) { } } -func TestSixteenThousandCookiesAreRefusedWellWithinTheTimeLimit(t *testing.T) { +func TestSixteenThousandCookiesAreRefusedBeforeTheCoreRuleSetReadsThem(t *testing.T) { t.Parallel() s := startDiscriminator(t, "", map[string]string{wafMode: block}) req := s.question(siteA, client, "/") req.Header.Set(cookieHeader, strings.Repeat("a;", 16000)) - began := time.Now() got := do(t, req) - if took := time.Since(began); took >= answerTimeLimit/2 { - t.Errorf("answered after %s, want well within %s", took, answerTimeLimit) - } - wantDisposition(t, got, tooLarge, discriminator.DispositionDeny) line := s.out.requestLine(t) @@ -209,13 +204,8 @@ func TestObserveModeAllowsARequestOverTheHeaderLimitsUnread(t *testing.T) { req := s.question(siteA, client, "/") req.Header.Set(cookieHeader, strings.Repeat("a;", 16000)) - began := time.Now() got := do(t, req) - if took := time.Since(began); took >= answerTimeLimit/2 { - t.Errorf("answered after %s, want well within %s", took, answerTimeLimit) - } - wantDisposition(t, got, http.StatusOK, discriminator.DispositionAllow) line := s.out.requestLine(t)