{"record":{"id":"c5878f8f3b63f18a","repo":"goharbor/harbor","slug":"bad-request-c5878f","errorCode":"BAD_REQUEST","errorMessage":"empty string","messagePattern":"empty string","errorType":"validation","errorClass":"errors.Error","httpStatus":400,"severity":"error","filePath":"src/lib/endpoint.go","lineNumber":31,"sourceCode":"// limitations under the License.\n\npackage lib\n\nimport (\n\t\"fmt\"\n\t\"net/url\"\n\t\"strings\"\n\n\t\"github.com/goharbor/harbor/src/lib/errors\"\n)\n\n// ValidateHTTPURL checks whether the provided string is a valid HTTP URL.\n// If it is, return the URL in format \"scheme://host:port\" to avoid the SSRF\nfunc ValidateHTTPURL(s string) (string, error) {\n\ts = strings.Trim(s, \" \")\n\ts = strings.TrimRight(s, \"/\")\n\tif len(s) == 0 {\n\t\treturn \"\", errors.New(nil).WithCode(errors.BadRequestCode).WithMessage(\"empty string\")\n\t}\n\tif !strings.Contains(s, \"://\") {\n\t\ts = \"http://\" + s\n\t}\n\turl, err := url.Parse(s)\n\tif err != nil {\n\t\treturn \"\", errors.New(nil).WithCode(errors.BadRequestCode).WithMessagef(\"invalid URL: %s\", err.Error())\n\t}\n\tif url.Scheme != \"http\" && url.Scheme != \"https\" {\n\t\treturn \"\", errors.New(nil).WithCode(errors.BadRequestCode).WithMessagef(\"invalid HTTP scheme: %s\", url.Scheme)\n\t}\n\t// To avoid SSRF security issue, refer to #3755 for more detail\n\treturn fmt.Sprintf(\"%s://%s%s\", url.Scheme, url.Host, url.Path), nil\n}\n","sourceCodeStart":13,"sourceCodeEnd":46,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/lib/endpoint.go#L13-L46","documentation":"Error \"empty string\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/lib/endpoint.go:31 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}