[DSH-001] Dashboard /alarms AlarmsPolicy bypassed by in-circuit navigation (plain RouteView) #243
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?
DSH-001 —
/alarmsAlarmsPolicyis bypassed by in-circuit navigationDashboard/Components/Routes.razor:4—<RouteView ...>, notAuthorizeRouteViewDashboard/Components/App.razor:13—<Routes @rendermode="InteractiveServer" />(global interactive routing)Dashboard/Components/Pages/AlarmsPage.razor:12—[Authorize(Policy = AlarmsPolicy)]is the only gate;OnInitialized(212–216) starts the poll and feed loops unconditionallyDashboard/DashboardEndpointRouteBuilderExtensions.cs:135-138— endpoint-levelRequireAuthorization(ViewerPolicy)src/ZB.MOM.WW.MxGateway.Tests/Gateway/Dashboard/AlarmFeedAuthorizationTests.cs:144-159— asserts endpoint metadata onlyDescription. The page attribute is enforced by endpoint routing on a full HTTP request to
/alarms. With the router rendered interactively, a navigation that starts inside an existing circuit never issues an HTTP request for the page: the in-circuitRouterresolves the route andRouteViewrenders it.RouteViewdoes not evaluate[Authorize]; onlyAuthorizeRouteViewdoes.AlarmsPagehas no in-component check, andIDashboardLiveDataService.QueryAlarmsAsync/IGatewayAlarmService.StreamAsynctake no principal.Failure scenario. Anonymous localhost (
AllowAnonymousLocalhost=true, the default) or any caller underAuthentication:Mode=Disabledloads/— allowed byViewerPolicy. The nav link is hidden (MainLayout.razor:18-22), but the caller runsBlazor.navigateTo('/alarms')in the console, or clicks any in-page anchor pointing at/alarms. The circuit rendersAlarmsPageand the galaxy-wide alarm list is displayed. This is exactly the audience the contract says "do not receive it at all".Related.
/admin/secrets(sharedZB.MOM.WW.Secrets.Uipage) relies on the same attribute mechanism, so a Viewer can reach it the same way. Its mutating and reveal controls are separately wrapped inAuthorizeViewin the library source, so the exposure there appears limited to the list itself. Not verified against the packaged 1.0.1 build.Suggested fix. Switch
Routes.razortoAuthorizeRouteViewwith aNotAuthorizedfragment. Check that anonymous localhost still passesViewerPolicyin-circuit, sinceDashboardAuthorizationHandlerreadsIHttpContextAccessor. As defense in depth, haveAlarmsPagecallIAuthorizationService.AuthorizeAsync(user, AlarmsPolicy)before starting its loops.Test idea. bUnit: render
Routeswith an unauthenticatedAuthenticationState, navigate theNavigationManagerto/alarms, assertAlarmsPageis not instantiated andIGatewayAlarmService.StreamAsyncis never called.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 D3 in
code-reviews/2026-12-02-perf-bugs/PLAN.md): theAuthorizeRouteViewfix must also be verified for/admin/secrets(Secrets.Ui) with a test: a Viewer navigating in-circuit gets NotAuthorized. If it was reachable before the fix, record that here as a confirmed exposure.Merged to
mainat68043411(pushed 2026-12-03). Gateway suite 1610 passed / 0 failed (macOS); windev worker CI 836 passed / 0 failed on that SHA.D3 result — confirmed exposure. A test run against the old
Routes.razorshowed a Viewer could reach/admin/secretsby in-circuit navigation (secret names, descriptions, KEK id, revision, updated-by; reveal/edit stayed hidden), and anonymous localhost could reach/alarmsthe same way. Both now get NotAuthorized viaAuthorizeRouteView(DashboardRouteAuthorizationTests). The test uses a stand-in for the Secrets page because the real page stack-overflowed under the test renderer — unverified whether that affects the live page.