{"record":{"id":"10ad146caed0f4e9","repo":"JuliusBrussee/caveman","slug":"https-required-http-is-test-only-on-explicit-loop","errorCode":null,"errorMessage":"HTTPS required; HTTP is test-only on explicit loopback","messagePattern":"HTTPS required; HTTP is test-only on explicit loopback","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/replay_http.go","lineNumber":265,"sourceCode":"\t\t}\n\tdefault:\n\t\treturn errors.New(\"cachebench: unsupported replay provider\")\n\t}\n\treturn nil\n}\n\nfunc validateReplayBaseURL(raw string, allowInsecureLoopback bool) (*url.URL, error) {\n\tparsed, err := url.Parse(strings.TrimSpace(raw))\n\tif err != nil || parsed.Host == \"\" || parsed.User != nil || parsed.RawQuery != \"\" || parsed.Fragment != \"\" {\n\t\treturn nil, errors.New(\"invalid absolute base URL\")\n\t}\n\tif parsed.Scheme == \"https\" {\n\t\treturn parsed, nil\n\t}\n\tif parsed.Scheme == \"http\" && allowInsecureLoopback && isLoopbackHost(parsed.Hostname()) {\n\t\treturn parsed, nil\n\t}\n\treturn nil, errors.New(\"HTTPS required; HTTP is test-only on explicit loopback\")\n}\n\nfunc validReplaySecret(value string) bool {\n\treturn validBoundedText(value, 16*1024, false)\n}\n\nfunc validAWSRegion(value string) bool {\n\tif len(value) < 3 || len(value) > 64 {\n\t\treturn false\n\t}\n\tfor _, char := range value {\n\t\tif char >= 'a' && char <= 'z' || char >= '0' && char <= '9' || char == '-' {\n\t\t\tcontinue\n\t\t}\n\t\treturn false\n\t}\n\treturn true\n}","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/replay_http.go#L247-L283","documentation":"validateReplayBaseURL was given an http:// (or other non-https) base URL that is not permitted: HTTP is allowed only for test traffic to an explicit loopback host when allowInsecureLoopback is set. Any non-https scheme targeting a non-loopback host, or loopback without the flag, fires this guard.","triggerScenarios":"Thrown at cacheengine/cachebench/replay_http.go:265 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use an https:// base URL for real replay targets","For local test servers, keep http:// but bind to an explicit loopback host (127.0.0.1/[::1]) and enable the allow-insecure-loopback option"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}