From 6c44821807cb619e3924a326b56a44dfcc2358d7 Mon Sep 17 00:00:00 2001 From: hoelee Date: Tue, 17 Nov 2026 23:29:43 +0800 Subject: [PATCH] test: cover the encoded scan-path case with the rule it expects to match --- botfilter_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/botfilter_test.go b/botfilter_test.go index 6b9c6409..d6ed5e05 100644 --- a/botfilter_test.go +++ b/botfilter_test.go @@ -73,6 +73,10 @@ func TestEncodedScanPathBansBeforeUpstream(t *testing.T) { cfg := CreateConfig() cfg.RequireUserAgent = false cfg.RequireAccept = false + // Blocked paths are opt-in, so the test must configure the rule it expects to + // match; the point under test is that the encoded traversal form normalises + // onto that rule instead of slipping past it. + cfg.BlockedPaths = []string{"/.env"} nextCalls := 0 handler, err := New(context.Background(), http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { nextCalls++