Expand description
Security utilities: URL credential redaction, error sanitization, and RTSP transport security policy.
§Credential redaction
redact_url strips user:password@ from URLs while preserving the
host, port, and path for diagnostic purposes. This prevents credentials
from leaking into logs, health events, or error messages.
§Error sanitization
sanitize_error_string cleans untrusted backend error/debug strings by:
- Stripping control characters and bare newlines.
- Capping to a configurable maximum length.
- Redacting patterns that resemble secrets (e.g.,
password=...,token=...,key=...).
§RTSP security policy
RtspSecurityPolicy controls whether rtsps:// (TLS) is preferred,
required, or explicitly opted-out for RTSP sources.
§Threat model
RTSP streams carry both video data and sometimes credentials in the URL. Without TLS:
- Credentials may be visible to network observers (man-in-the-middle).
- Video data is transmitted in the clear.
- An attacker on the network can spoof or tamper with the stream.
PreferTls (the default) upgrades bare rtsp:// URLs to rtsps:// so
that production deployments default to encrypted transport without
requiring code changes. Field deployments behind firewalls or with
cameras that don’t support TLS can opt out with AllowInsecure.
§Migration path
- Existing code that passes explicit
rtsp://URLs will continue to work — the URL is promoted tortsps://unlessAllowInsecureis set or the URL already usesrtsps://. - If a camera does not support TLS, set
AllowInsecureon the source spec. A health warning will be emitted. - For high-security deployments, set
RequireTlsto reject any unencrypted RTSP source at config validation time.
Enums§
- Custom
Pipeline Policy - Whether
SourceSpec::Custompipeline fragments are trusted. - Rtsp
Security Policy - RTSP transport security policy.
Functions§
- is_
insecure_ rtsp - Check whether an RTSP URL uses insecure (non-TLS) transport.
- promote_
rtsp_ to_ tls - Apply URL scheme promotion for RTSP sources under
RtspSecurityPolicy::PreferTls. - redact_
url - Redact credentials from a URL string.
- redact_
urls_ in_ string - Apply
redact_urlto all URL-like substrings in a string. - sanitize_
error_ string - Sanitize an untrusted error/debug string from a backend.