test: cover the encoded scan-path case with the rule it expects to match
ci / middleware (go) (push) Canceled after 0s
ci / py-monitor (python) (push) Canceled after 0s
ci / java-cache (maven) (push) Canceled after 0s
ci / shell-sync (syntax) (push) Canceled after 0s

This commit is contained in:
hoelee committed 2026-11-17 14:24:00 +08:00
1 parent ffdff393e4
commit d9ad51ef73
1 file changed
+4
+4
View File
@@ -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++