Harden scan robustness and tests

This commit is contained in:
ZacharyZcR
2026-06-13 07:55:37 +08:00
parent 1595c92aed
commit 15a7670ba2
100 changed files with 4483 additions and 412 deletions
+19
View File
@@ -0,0 +1,19 @@
//go:build plugin_elasticsearch || plugin_neo4j || plugin_rabbitmq || !plugin_selective
package services
import (
"strings"
"testing"
)
func TestReadServiceHTTPBodyIsBounded(t *testing.T) {
body := strings.NewReader(strings.Repeat("a", maxServiceHTTPBodyBytes+1024))
got, err := readServiceHTTPBody(body)
if err != nil {
t.Fatalf("readServiceHTTPBody error = %v", err)
}
if len(got) != maxServiceHTTPBodyBytes {
t.Fatalf("body len = %d, want %d", len(got), maxServiceHTTPBodyBytes)
}
}