docs(grpc-data): plan §5.2 condition_key formula matches ConditionKeys.Derive (realm byte, upper-cased cluster) + golden-vector test

This commit is contained in:
Joseph Doherty
2026-11-24 10:37:02 -05:00
parent f08ca7d9e3
commit 3b242f5839
2 changed files with 39 additions and 3 deletions
@@ -570,9 +570,13 @@ addressed in that realm:
it is `"<len>:<driverInstanceId><RawPath>"` (`SourceSamplePublisher.cs:32-33`, emitted at
`LocalExportCatalog.Compilation.cs:92,123`), so it would disclose the RawPath.
`condition_key = base64url(HMAC-SHA256(K, originClusterId ‖ 0x00 ‖ ConditionId))`, where
K = HKDF(`DataConnections:ConditionKeySecret`, info = `"otopcua/condition-key/v1"`). The secret is a per-origin-cluster
`${secret:}`, identical on both pair members.
`condition_key = base64url(HMAC-SHA256(K, UTF8(upper(originClusterId)) ‖ 0x00 ‖ realm ‖ UTF8(ConditionId)))` (unpadded
base64url, 43 characters), where `upper` is the invariant upper-casing (cluster ids compare OrdinalIgnoreCase), `realm` is one
byte — `0x01` = Raw (a native condition, ConditionId = RawPath), `0x02` = Uns (a scripted condition, ConditionId =
ScriptedAlarmId) — so a native and a scripted condition with equal id strings never share a key, and
K = HKDF-SHA256(IKM = UTF8(`DataConnections:ConditionKeySecret`), salt = empty, info = `"otopcua/condition-key/v1"`, L = 32).
This is exactly `ConditionKeys.Derive` and is pinned by a golden-vector test (`ConditionKeysTests`). The secret is a
per-origin-cluster `${secret:}` of at least 32 UTF-8 bytes, identical on both pair members.
- It is stable across restarts, failover and re-deploys.
- It is identical across all of the origin's listings and principals, so the consumer dedupes Raw and UNS placements.