fix(acl): close the #808 review findings — reference variables, owner folder chain, NUL keys, unknown ids (#808)
Review of af5c9744:
1. UNS reference variables (s=Area/Line/Equip/Eff) of a moved or renamed
equipment stayed readable/writable under the OLD names' grants: they now
resolve as ReferenceVariable and are authorized at their split path only
while it equals their live equipment folder's placement (live chain ==
generation chain) + one name; otherwise denied (Read and Write).
2. TryPlaceScriptedCondition now also requires the owner folder's live chain
to match the generation (AuthorizeScriptedCondition gains ownerFolderChain),
so a moved equipment's alarm/children/commands follow its folder.
3. Identifiers containing NUL are denied before the decision cache, keeping
client ids disjoint from the NUL-prefixed resolved-scope keys (a client
could otherwise poison a real folder's cached verdict for its key shard).
4. An id no live node holds is Unknown: placed at [\0unknown] so only
Cluster / Namespace-uns grants decide it (a removed opaque id can no longer
split onto a same-named narrow grant; narrow grantees get no NodeDeleted for
removed UNS folders/vtags/conditions — documented); 4-segment
reference-shaped ids keep their split.
5. A wire test drives placements from DeploymentArtifact.ParseDataPlaneAuthority.
Baseline updates: #797 owner tests (unit + wire) and Sdk2RepeatedAlarmAuthority
now install folder scopes; Sdk2HistoryAuthority's UNS alias used the RAW path
as its UNS id (never minted in production) and now carries EqA/HistoryAlias.
Each new guard was falsified (reverting it fails its test).
This commit is contained in:
@@ -112,14 +112,24 @@ Two things to know before relying on any of this:
|
||||
denied under old AND new line until the rebuild). Owned nodes (vtags, conditions, children) get
|
||||
`owner path + DataPlaneAuthorizer.OwnedNodeSegment` — only equipment-or-ancestor grants confer them, and a Tag
|
||||
grant's Browse transit can't enumerate them. Conditions share `TryPlaceScriptedCondition` with the #797 command
|
||||
gate. Reference variables (`s=Area/Line/Equip/Name`) keep the split. ⚠️ The folder-owned rule keys on "first id
|
||||
segment == nearest slash-free live UNS folder ancestor's id", which can only narrow (an Area named exactly like
|
||||
its equipment's id loses that variable's Tag-grant match). ⚠️ `ConditionVisibilityScopes` returns the condition
|
||||
ALONE for a scripted condition, so a moved alarm can't reach its old owner via the Server object; direct
|
||||
per-folder event items still ride the SDK fan-out of the folder it hangs under. Unplaceable ⇒ denied for every
|
||||
grant incl. Cluster (a behaviour change for Cluster keys only in the stale window / corrupt topology). Tests:
|
||||
`UnsFolderScopeWireTests` (opaque ids); rig tests (`ServerEventRig.FolderScopes()`, `EqA` ⇒ `[uns, EqA]`) now
|
||||
install folder scopes explicitly — without them every UNS folder denies.
|
||||
gate, which ALSO requires the owner folder's live chain to match (review: else the new line could command a moved
|
||||
equipment's alarm while its folder is denied). Reference variables (`s=Area/Line/Equip/Name`) keep their split
|
||||
path (so Tag grants match) but only while it equals their live equipment folder's placement + one name — a
|
||||
moved/renamed equipment's old-name variables are denied (Read AND Write) under old and new names until
|
||||
re-pointed. An id NO live node holds (removed / probe / NodeDeleted `Affected`) is `Unknown`: placed at
|
||||
`[\0unknown]`, so only Cluster / Namespace-uns grants decide it and a removed opaque id can never split onto a
|
||||
same-named narrow grant — except a 4-segment (reference-shaped) id, which keeps its split. ⇒ narrow grantees do
|
||||
NOT receive NodeDeleted for removed UNS folders / vtags / conditions (by decision; they re-browse). Identifiers
|
||||
containing NUL are denied before the cache (resolved-scope keys are NUL-prefixed — a client could otherwise
|
||||
poison a real folder's cached verdict). ⚠️ The folder-owned rule keys on "first id segment == nearest slash-free
|
||||
live UNS folder ancestor's id", which can only narrow (an Area named exactly like its equipment's id loses that
|
||||
variable's Tag-grant match). ⚠️ `ConditionVisibilityScopes` returns the condition ALONE for a scripted condition,
|
||||
so a moved alarm can't reach its old owner via the Server object; direct per-folder event items still ride the
|
||||
SDK fan-out of the folder it hangs under (follow-up). A UNS node with NO live hierarchy-folder ancestor (rig-only
|
||||
shape) keeps the plain split. Unplaceable ⇒ denied for every grant incl. Cluster (a behaviour change for Cluster
|
||||
keys only in the stale window / corrupt topology). Tests: `UnsFolderScopeWireTests` (opaque ids, incl. one fed by
|
||||
`DeploymentArtifact.ParseDataPlaneAuthority`); rig tests (`ServerEventRig.FolderScopes()`, `EqA` ⇒ `[uns, EqA]`)
|
||||
install folder scopes explicitly — without them every UNS folder and scripted condition denies.
|
||||
- **Revocation reaches live subscriptions** (stage 6): every other operation re-asks per request, but a
|
||||
subscription is authorized once and then streams — and streaming is how machine consumers actually
|
||||
read this server. `DataPlaneAuthorityState.Changed` fires `RevalidateMonitoredItems`. ⚠️ A denied
|
||||
|
||||
Reference in New Issue
Block a user