Review 2026-12-02 Phase 0: Authorization and auth throttling #251
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase 0 — Authorization and auth throttling (p0)
These are real trust-boundary gaps. The SES-002, SES-003 and DSH-001 code paths were re-checked by hand.
EnsureOwner(session, identity)helper next toResolveSessioninGrpc/MxAccessGatewayService.csand call it fromInvokeandCloseSession, returningPermissionDenied(same ordinal compare asEventStreamService.cs:58). Decide whether anadmin-scoped key may override, and record that indocs/Authorization.mdanddocs/DesignDecisions.md. InternalISessionManagercallers (alarm monitor, dashboard) are unaffected.Invoke(DrainEvents/Write)andCloseSessionon key A's session givesPermissionDenied, and A's session staysReady.AddBufferedItemcase toApplyConstraintsAsyncthat callsEnforceReadTagAsync(command.AddBufferedItem.ItemDefinition). Also make the switch fail closed: maintain an explicit allow-list of command kinds that carry no tag, and send any new tag-bearing kind to the check (a test enumeratesMxCommandKind).AddBufferedItemgivesPermissionDeniedplus an audited denial, and no worker command is sent. Enum-coverage test.RouteViewwithAuthorizeRouteView(withNotAuthorizedcontent) inDashboard/Components/Routes.razor. Check/admin/secrets(Secrets.Ui) under the same path./alarmsgets NotAuthorized.context.Peer, or useHttpContext.Connection.RemoteIpAddress).StreamEventsand the stream ends withUnauthenticated. Hub connection is closed after the token expires.Verify:
dotnet build src/ZB.MOM.WW.MxGateway.NonWindows.slnx; filtered testsMxAccessGatewayService*,GatewayGrpcScope*,*FailureLimiter*,Dashboard*Authorization*; full gateway suite once.High findings filed separately:
Source:
code-reviews/2026-12-02-perf-bugs/README.mdandcode-reviews/2026-12-02-perf-bugs/PLAN.md(commitf200bda6on local branchdocs/review-2026-12-02-perf-bugs, not yet pushed). Reviewed at54367e74.Decision (2026-12-03, recorded as D2/D3/D10 in
code-reviews/2026-12-02-perf-bugs/PLAN.md): see the comments on #241 and #243. Medium/Low findings stay as rows in these phase issues; no separate issues unless split out, deferred or grown.Merged to
mainat68043411(pushed 2026-12-03). Gateway suite 1610 passed / 0 failed (macOS); windev worker CI 836 passed / 0 failed on that SHA.All rows 0.1–0.6 done. Known gaps (documented):
apikeyCLI revocation doesn't end open streams (separate process); LDAP group removal / sign-out elsewhere takes effect at the 8 h cookie limit or reconnect. Behaviour change: key rotate also ends that key's streams.