fix(security): enforce resource isolation across API and hubs
This commit is contained in:
1 parent
21f0530b6c
commit
1cd4e2b4b5
39 files changed
+1081
-497
No files matched your search
@@ -130,7 +130,7 @@ public NetworkCameraScanner(
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogTrace(ex, "Probe error for {Ip}", ip);
|
||||
_logger.LogTrace("Probe error for {Ip} (error type {ErrorType})", ip, ex.GetType().Name);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -271,7 +271,7 @@ public NetworkCameraScanner(
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "HomeKit mDNS discovery failed");
|
||||
_logger.LogWarning("HomeKit mDNS discovery failed (error type {ErrorType})", ex.GetType().Name);
|
||||
}
|
||||
|
||||
return devices;
|
||||
@@ -348,7 +348,7 @@ public NetworkCameraScanner(
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "DVRIP discovery failed");
|
||||
_logger.LogWarning("DVRIP discovery failed (error type {ErrorType})", ex.GetType().Name);
|
||||
}
|
||||
|
||||
return devices;
|
||||
@@ -515,7 +515,7 @@ public NetworkCameraScanner(
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "ONVIF WS-Discovery multicast failed");
|
||||
_logger.LogWarning("ONVIF WS-Discovery multicast failed (error type {ErrorType})", ex.GetType().Name);
|
||||
}
|
||||
|
||||
return devices;
|
||||
@@ -618,7 +618,7 @@ public NetworkCameraScanner(
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
_logger.LogTrace(ex, "HTTP probe failed for {Ip}:{Port}", ip, port);
|
||||
_logger.LogTrace("HTTP probe failed for {Ip}:{Port} (error type {ErrorType})", ip, port, ex.GetType().Name);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -685,7 +685,7 @@ public NetworkCameraScanner(
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogTrace(ex, "ONVIF probe failed for {Ip}:{Port}", ip, port);
|
||||
_logger.LogTrace("ONVIF probe failed for {Ip}:{Port} (error type {ErrorType})", ip, port, ex.GetType().Name);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -714,7 +714,7 @@ public NetworkCameraScanner(
|
||||
if (digest is not null)
|
||||
{
|
||||
_logger.LogInformation(
|
||||
"ONVIF auth succeeded with credential '{Label}' for {Url}", credential.Label, deviceServiceUrl);
|
||||
"ONVIF auth succeeded with credential '{Label}'", credential.Label);
|
||||
return digest with { CredentialLabel = credential.Label };
|
||||
}
|
||||
|
||||
@@ -723,7 +723,7 @@ public NetworkCameraScanner(
|
||||
if (text is not null)
|
||||
{
|
||||
_logger.LogInformation(
|
||||
"ONVIF auth (PasswordText) succeeded with credential '{Label}' for {Url}", credential.Label, deviceServiceUrl);
|
||||
"ONVIF auth (PasswordText) succeeded with credential '{Label}'", credential.Label);
|
||||
return text with { CredentialLabel = credential.Label };
|
||||
}
|
||||
}
|
||||
@@ -752,7 +752,7 @@ public NetworkCameraScanner(
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
_logger.LogTrace(ex, "GetDeviceInformation failed for {Url}", deviceServiceUrl);
|
||||
_logger.LogTrace("GetDeviceInformation failed for [camera endpoint]");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -832,7 +832,7 @@ public NetworkCameraScanner(
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
_logger.LogTrace(ex, "GetStreamUri failed for {Url}", deviceServiceUrl);
|
||||
_logger.LogTrace("GetStreamUri failed for [camera endpoint]");
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -1041,9 +1041,9 @@ public NetworkCameraScanner(
|
||||
{
|
||||
// cancelled
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
_logger.LogTrace(ex, "Stream test failed for {Url}", url);
|
||||
_logger.LogTrace("Stream test failed for [camera endpoint]");
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -1105,7 +1105,7 @@ public NetworkCameraScanner(
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
_logger.LogTrace(ex, "RTSP probe failed for {Url}", url);
|
||||
_logger.LogTrace("RTSP probe failed for [camera endpoint]");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1131,7 +1131,7 @@ public NetworkCameraScanner(
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
_logger.LogTrace(ex, "HTTP stream probe failed for {Url}", url);
|
||||
_logger.LogTrace("HTTP stream probe failed for [camera endpoint]");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1203,16 +1203,16 @@ public NetworkCameraScanner(
|
||||
{
|
||||
if (ret is 100 or 515)
|
||||
{
|
||||
_logger.LogDebug("DVRIP login OK for {Url}", url);
|
||||
_logger.LogDebug("DVRIP login OK for [camera endpoint]");
|
||||
return true;
|
||||
}
|
||||
_logger.LogDebug("DVRIP login rejected (Ret={Ret}) for {Url}", ret, url);
|
||||
_logger.LogDebug("DVRIP login rejected (Ret={Ret}) for [camera endpoint]", ret);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
_logger.LogTrace(ex, "DVRIP probe failed for {Url}", url);
|
||||
_logger.LogTrace("DVRIP probe failed for [camera endpoint]");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1319,12 +1319,12 @@ public NetworkCameraScanner(
|
||||
var c1Read = await ReadExactWithTimeoutAsync(stream, c1, DvripTimeout, ct).ConfigureAwait(false);
|
||||
|
||||
var alive = c0[0] == 0x03 && c1Read;
|
||||
_logger.LogDebug("RTMP probe {Result} for {Url}", alive ? "OK" : "failed", url);
|
||||
_logger.LogDebug("RTMP probe {Result} for [camera endpoint]", alive ? "OK" : "failed");
|
||||
return alive;
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
_logger.LogTrace(ex, "RTMP probe failed for {Url}", url);
|
||||
_logger.LogTrace("RTMP probe failed for [camera endpoint]");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1379,12 +1379,12 @@ public NetworkCameraScanner(
|
||||
// Skip the binary preamble in the response, look for the HTTP status.
|
||||
var httpIndex = response.IndexOf("HTTP/1.", StringComparison.Ordinal);
|
||||
var alive = httpIndex >= 0 && response.AsSpan(httpIndex).StartsWith("HTTP/1.1 200", StringComparison.OrdinalIgnoreCase);
|
||||
_logger.LogDebug("Bubble probe {Result} for {Url}", alive ? "OK" : "failed", url);
|
||||
_logger.LogDebug("Bubble probe {Result} for [camera endpoint]", alive ? "OK" : "failed");
|
||||
return alive;
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
_logger.LogTrace(ex, "Bubble probe failed for {Url}", url);
|
||||
_logger.LogTrace("Bubble probe failed for [camera endpoint]");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1429,12 +1429,12 @@ public NetworkCameraScanner(
|
||||
var response = Encoding.ASCII.GetString(buffer, 0, n);
|
||||
// 200, 401 (pairing required) and 470 (auth required) all prove a live HAP service.
|
||||
var alive = response.StartsWith("HTTP/1.1", StringComparison.OrdinalIgnoreCase);
|
||||
_logger.LogDebug("HomeKit probe {Result} for {Url} ({Response})", alive ? "OK" : "failed", url, response.Split('\r')[0]);
|
||||
_logger.LogDebug("HomeKit probe {Result} for [camera endpoint] ({Response})", alive ? "OK" : "failed", response.Split('\r')[0]);
|
||||
return alive;
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
_logger.LogTrace(ex, "HomeKit probe failed for {Url}", url);
|
||||
_logger.LogTrace("HomeKit probe failed for [camera endpoint]");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1515,9 +1515,9 @@ public NetworkCameraScanner(
|
||||
{
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
_logger?.LogTrace(ex, "Screenshot capture failed for {Url}", url);
|
||||
_logger?.LogTrace("Screenshot capture failed for [camera endpoint]");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user