{"record":{"id":"cba5b5d06cff6948","repo":"AlexxIT/go2rtc","slug":"streams-source-with-spaces-may-be-insecure","errorCode":null,"errorMessage":"streams: source with spaces may be insecure","messagePattern":"streams: source with spaces may be insecure","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/streams/handlers.go","lineNumber":131,"sourceCode":"}\n\nvar insecure = map[string]bool{}\n\nfunc MarkInsecure(scheme string) {\n\tinsecure[scheme] = true\n}\n\nvar sanitize = regexp.MustCompile(`\\s`)\n\nfunc Validate(source string) error {\n\t// TODO: Review the entire logic of insecure sources\n\tif i := strings.IndexByte(source, ':'); i > 0 {\n\t\tif insecure[source[:i]] {\n\t\t\treturn errors.New(\"streams: source from insecure producer\")\n\t\t}\n\t}\n\tif sanitize.MatchString(source) {\n\t\treturn errors.New(\"streams: source with spaces may be insecure\")\n\t}\n\treturn nil\n}\n","sourceCodeStart":113,"sourceCodeEnd":135,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/internal/streams/handlers.go#L113-L135","documentation":"Validate's sanitize guard (regexp matching any whitespace) rejects source URLs containing spaces. This is a security-oriented sanity check: spaces in a source string usually indicate a truncated, malformed, or injection-crafted URL rather than a legitimate address.","triggerScenarios":"Thrown at internal/streams/handlers.go:131 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Percent-encode spaces (%20) in query parameters of the source URL","Fix the upstream config that produced a truncated or concatenated URL","Remove stray whitespace around the source string before validation"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c245815e75e2a5fd60b4290f12bfc04e55a984d3","analyzedAt":"2026-09-07T11:47:02.965Z","contentChangedAt":"2026-09-07T11:47:02.965Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}