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
@@ -79,10 +79,12 @@ public sealed class ConfigReceiverService : BackgroundService
|
||||
.WithAutomaticReconnect(new RetryDelayed(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(30)))
|
||||
.Build();
|
||||
|
||||
_connection.On("DiscoveryScanRequested", () => _scanTrigger.Trigger());
|
||||
|
||||
// Listen for setting changes
|
||||
_connection.On<string, string>("SettingChanged", (key, value) =>
|
||||
{
|
||||
_logger.LogInformation("Config update received: {Key} = {Value}", key, value);
|
||||
_logger.LogInformation("Config update received: {Key}", key);
|
||||
ApplySetting(key, value);
|
||||
});
|
||||
|
||||
@@ -109,7 +111,7 @@ public sealed class ConfigReceiverService : BackgroundService
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Failed to rejoin agent group after reconnect");
|
||||
_logger.LogWarning("Failed to rejoin agent group after reconnect (error type {ErrorType})", ex.GetType().Name);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -119,7 +121,7 @@ public sealed class ConfigReceiverService : BackgroundService
|
||||
try
|
||||
{
|
||||
await _connection.StartAsync(stoppingToken);
|
||||
_logger.LogInformation("Connected to config hub at {HubUrl}", hubUrl);
|
||||
_logger.LogInformation("Connected to config hub");
|
||||
|
||||
// Join our personal config channel
|
||||
await _connection.InvokeAsync("JoinAgentGroup", _state.AgentId.ToString(), stoppingToken);
|
||||
@@ -136,7 +138,7 @@ public sealed class ConfigReceiverService : BackgroundService
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Config hub connection failed, retrying in 15s...");
|
||||
_logger.LogWarning("Config hub connection failed, retrying in 15s... (error type {ErrorType})", ex.GetType().Name);
|
||||
await Task.Delay(TimeSpan.FromSeconds(15), stoppingToken);
|
||||
}
|
||||
}
|
||||
@@ -173,7 +175,7 @@ public sealed class ConfigReceiverService : BackgroundService
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning("Ignored invalid heartbeat interval: {Value}", value);
|
||||
_logger.LogWarning("Ignored invalid heartbeat interval");
|
||||
}
|
||||
break;
|
||||
case "log.level":
|
||||
@@ -184,7 +186,7 @@ public sealed class ConfigReceiverService : BackgroundService
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning("Ignored invalid log level: {Value}", value);
|
||||
_logger.LogWarning("Ignored invalid log level");
|
||||
}
|
||||
break;
|
||||
case "discovery.scan.requested":
|
||||
@@ -203,19 +205,19 @@ public sealed class ConfigReceiverService : BackgroundService
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning("Ignored invalid autoUpdateEnabled value: {Value}", value);
|
||||
_logger.LogWarning("Ignored invalid autoUpdateEnabled value");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (RestartRequiredPrefixes.Any(p => key.StartsWith(p, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
_logger.LogWarning(
|
||||
"Setting {Key} = {Value} requires an agent restart to take effect (not applied live)",
|
||||
key, value);
|
||||
"Setting {Key} requires an agent restart to take effect (not applied live)",
|
||||
key);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogDebug("Unknown setting {Key} = {Value} (stored for future use)", key, value);
|
||||
_logger.LogDebug("Unknown setting {Key} (stored for future use)", key);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -243,7 +245,7 @@ public sealed class ConfigReceiverService : BackgroundService
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Failed to decrypt camera credential pool (kept previous pool)");
|
||||
_logger.LogWarning("Failed to decrypt camera credential pool (kept previous pool) (error type {ErrorType})", ex.GetType().Name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,7 +289,7 @@ public sealed class ConfigReceiverService : BackgroundService
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Failed to fetch full configuration");
|
||||
_logger.LogWarning("Failed to fetch full configuration (error type {ErrorType})", ex.GetType().Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user