mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-07 14:04:10 +03:00
mask passwords in http-flv and others where a url param is password
This commit is contained in:
parent
40affdd014
commit
c64d49ce89
@ -73,12 +73,22 @@ export async function detectReolinkCamera(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mask credentials in RTSP URIs for display (e.g., rtsp://user:pass@host -> rtsp://user:••••@host)
|
* Mask credentials in RTSP URIs for display
|
||||||
*/
|
*/
|
||||||
export function maskUri(uri: string): string {
|
export function maskUri(uri: string): string {
|
||||||
try {
|
try {
|
||||||
const match = uri.match(/rtsp:\/\/([^:]+):([^@]+)@(.+)/);
|
// Handle RTSP URLs with user:pass@host format
|
||||||
if (match) return `rtsp://${match[1]}:${"*".repeat(4)}@${match[3]}`;
|
const rtspMatch = uri.match(/rtsp:\/\/([^:]+):([^@]+)@(.+)/);
|
||||||
|
if (rtspMatch) {
|
||||||
|
return `rtsp://${rtspMatch[1]}:${"*".repeat(4)}@${rtspMatch[3]}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle HTTP/HTTPS URLs with password query parameter
|
||||||
|
const urlObj = new URL(uri);
|
||||||
|
if (urlObj.searchParams.has("password")) {
|
||||||
|
urlObj.searchParams.set("password", "*".repeat(4));
|
||||||
|
return urlObj.toString();
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user