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
+9
View File
@@ -1,3 +1,5 @@
//go:build plugin_postgresql || !plugin_selective
package services
import (
@@ -21,3 +23,10 @@ func TestPostgreSQLConnStringEscapesIPv6AndCredentials(t *testing.T) {
}
}
}
func TestPostgreSQLVulnInfoTruncatesByRune(t *testing.T) {
got := truncateRunes(strings.Repeat("界", 105), 100)
if len([]rune(got)) != 103 || !strings.HasSuffix(got, "...") {
t.Fatalf("postgresql truncation helper = %q", got)
}
}