fix: reject empty ClickHouse TLS parameters

This commit is contained in:
MiMoCode
2026-07-10 18:28:33 +08:00
parent d1bbb5370c
commit c4a985e9ca
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -118,7 +118,7 @@ func ClickHouseOptions(raw string) (*clickhouse.Options, error) {
if _, ok := query["skip_verify"]; ok && !wantSecure {
return nil, fmt.Errorf("invalid CLICKHOUSE_URL: skip_verify requires clickhouses")
}
if value, ok := query["skip_verify"]; ok && value[0] != "" {
if value, ok := query["skip_verify"]; ok {
if _, err := strconv.ParseBool(value[0]); err != nil {
return nil, fmt.Errorf("invalid CLICKHOUSE_URL: skip_verify: %w", err)
}
+1
View File
@@ -77,6 +77,7 @@ func TestClickHouseOptionsRejectsInvalidDSN(t *testing.T) {
"clickhouse://localhost:9000/db?secure=true",
"clickhouses://localhost:9440/db?secure=false",
"clickhouses://localhost:9440/db?skip_verify=maybe",
"clickhouses://localhost:9440/db?skip_verify=",
"clickhouse://localhost:9000/db?skip_verify=true",
"https://localhost:9440/db",
}