fix(secrets): SqlServer/Akka extensions take contentRootPath; last explicit root wins (scadaproj#31)

The SQL-Server extensions called the 3-arg AddZbSecrets, and the store-path
validator captured the content root of whichever call registered it first.
In hub mode no registration order applied the pre-host under-content-root
guard: extension-first dropped the app's 4-arg root, core-first lost the
replicator (#30). That is the 0.6.0 store-path hole, reopened.

- AddZbSecretsSqlServerStore / AddZbSecretsSqlServerReplication /
  AddZbSecretsAkkaReplication gain a trailing optional contentRootPath,
  forwarded to the 4-arg AddZbSecrets
- the root now lives in one SecretsContentRoot instance holder per service
  collection; the last explicit root wins, null never erases one; the
  IHostEnvironment fallback is unchanged
- tests: ContentRootTests (hub mode, three compositions, artifact asserted
  before the throw, positive control), last-explicit-wins theory in
  SecretsStorePathRulesTests, Akka forwarding test
- code-reviews: Secrets-002 Resolved; README regenerated

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-09 14:50:07 -05:00
parent 015c556ced
commit c3b07d6766
10 changed files with 272 additions and 18 deletions
+4 -1
View File
@@ -182,7 +182,10 @@ node can always reach a shared database, because you pay real distributed-system
Since `0.6.6` all three extensions are **order-independent** with respect to `AddZbSecrets`: call
it before or after them (or not at all — each calls it internally) and the same store, migrator and
replicator are bound.
replicator are bound. Each also takes an optional `contentRootPath`, forwarded to `AddZbSecrets`:
pass it from any **pre-host** composition (e.g. the container a `${secret:}` expander builds), just as
you would the 4-argument `AddZbSecrets`, so the store-path guard can reject a store inside the content
root. The last explicitly supplied root wins across calls.
### What replication costs you (2 and 3)