{"record":{"id":"881071bdf9369d68","repo":"AlexxIT/go2rtc","slug":"streams-source-from-insecure-producer","errorCode":null,"errorMessage":"streams: source from insecure producer","messagePattern":"streams: source from insecure producer","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/streams/handlers.go","lineNumber":127,"sourceCode":"\t\t}\n\t}\n\n\treturn nil, nil, errors.New(\"streams: unsupported scheme: \" + url)\n}\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":109,"sourceCodeEnd":135,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/internal/streams/handlers.go#L109-L135","documentation":"Validate rejects a source URL whose scheme has been marked insecure via MarkInsecure. It is a policy guard, not a protocol error: the scheme itself is functional but deliberately blocked (see the TODO about reviewing insecure-source logic), so any source using it fails validation before a stream is created.","triggerScenarios":"Thrown at internal/streams/handlers.go:127 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Switch to a secure variant of the protocol (e.g. rtsps/https instead of rtsp/http)","Find where MarkInsecure was called for this scheme and remove or override it if the source is trusted","Wrap the insecure source in a secure proxy and use the proxied URL"],"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"}