fix(secrets): review round 1 — gate the clustered-central secrets warning on Replication:Enabled, name the real trigger in the shared-store connection-string message, pin Grpc-vs-Store:Provider precedence

This commit is contained in:
Joseph Doherty
2026-09-28 17:56:30 -04:00
parent 35235ecfed
commit a57c36f504
5 changed files with 88 additions and 14 deletions
@@ -238,6 +238,7 @@ public static class StartupValidator
var seedNodes = configuration.GetSection("ScadaBridge:Cluster:SeedNodes").Get<List<string>>();
var provider = InboundApiKeyStoreOptions.ReadProvider(configuration);
var secretsStoreProvider = configuration["Secrets:Store:Provider"];
var secretsReplicationEnabled = configuration.GetValue<bool>("Secrets:Replication:Enabled");
var isClusteredCentral = role == "Central" && seedNodes is { Count: >= 2 };
var warnings = new List<string>();
@@ -255,7 +256,16 @@ public static class StartupValidator
// explicitly "Sqlite". A fleet that ships secrets to sites on every artifact deploy needs
// both central nodes to deploy the SAME secret set; a per-node store means each node has
// silently drifted the moment anyone edits a secret on only one of them.
//
// Gated off when Secrets:Replication:Enabled is true (review round 1, finding #1): that
// flag already puts this central node on a topology that shares state across the pair —
// the pre-existing gRPC hub (whose OWN central-side store is the shared SQL-Server store,
// not per-node SQLite — see SecretsRegistration's Grpc branch) or SQL-Server replication
// (ReplicatingSecretStore). Firing this warning there would be a false positive against
// the design's own named production topology (scadaproj#3), telling an operator to set a
// key that is already functionally moot.
if (isClusteredCentral
&& !secretsReplicationEnabled
&& !string.Equals(secretsStoreProvider, "SqlServer", StringComparison.OrdinalIgnoreCase))
{
warnings.Add(