fix(clients): permission-gate every nav surface to mirror server authorization#1298
Merged
Conversation
…orization
A tenant user whose role lacks a module permission could still see and open
nav entries for that module, landing on a guaranteed 403 (e.g. the dashboard
Files page showing "FAILURE - ForbiddenException" for the demo Manager role).
Dashboard:
- nav-data.ts: gate Chat, My Files, Subscription, Invoices, Products,
Brands, Categories, and Tickets on the same permission their page's
primary endpoint enforces. Live activity (auth-only SSE) and Health
(anonymous probe) stay ungated.
- command palette: the Navigate and Create actions were a second, fully
ungated nav surface. Added perm/anyPerm gates mirroring nav-data.ts and
the create endpoints' permissions; empty groups are dropped.
Admin:
- Webhooks nav entry and routes had no gate even though the API now
requires Permissions.Webhooks.View; added the nav perm + RouteGuard.
- Mirrored WebhooksPermissions into lib/permissions.ts and added the
missing Webhooks group to PERMISSION_CATALOG so the Role editor can
actually grant those permissions.
DemoSeeder:
- The acme Manager role's catalog claims used permission names that do not
exist ("Permissions.Brands.View" vs the real
"Permissions.Catalog.Brands.View"), silently granting nothing. Role
permission lists now reference the module contracts constants so they
cannot drift again. Re-run the migrator seed-demo verb to heal existing
databases.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
GitHub advisory GHSA-hv8m-jj95-wg3x (high severity, LZ4 decompression AccessViolationException) was published against MessagePack < 2.5.301, which Microsoft.AspNetCore.SignalR.StackExchangeRedis pulls in at 2.5.187. NuGet audit runs with warnings-as-errors, so every restore in CI now fails with NU1903 — breaking all PR checks regardless of their content. CentralPackageTransitivePinningEnabled is on, so a single PackageVersion entry bumps the transitive across the solution. Remove the pin once the SignalR backplane package references a patched MessagePack itself. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A tenant user whose role lacks a module permission could still see and open nav entries for that module, landing on a guaranteed 403 — e.g. the dashboard Files page rendering
FAILURE · ForbiddenExceptionfor the demo Manager user (Maya Lin), whose role has noPermissions.Files.*grants.The gating infrastructure (
perm/anyPermonNavSpec, introduced for the Recycle bin in #1294) already existed — most entries just never got gates.What changed
Dashboard (
clients/dashboard)nav-data.ts: gate Chat, My Files, Subscription, Invoices, Products, Brands, Categories, and Tickets on the same permission their page's primary endpoint enforces server-side. Live activity (auth-only SSE) and Health (anonymous probe) intentionally stay ungated.perm/anyPermgates mirroringnav-data.tsand the create endpoints; groups left empty after filtering are dropped.Admin (
clients/admin)Permissions.Webhooks.View. Added the nav perm +RouteGuard(list + detail), and updated the stale "any signed-in user" comment.WebhooksPermissionsintolib/permissions.tsand added the missing Webhooks group toPERMISSION_CATALOG— without it the Role editor could not grant webhook permissions at all.DbMigrator demo seed
Permissions.Brands.Viewvs the realPermissions.Catalog.Brands.View), silently granting nothing — "full catalog" never worked for the Manager demo user. Role permission lists now reference the module contracts constants (CatalogPermissions,IdentityPermissions,TicketsPermissions) so they cannot drift again.dotnet run --project src/Host/FSH.Starter.DbMigrator -- seed-demo(idempotent — adds the corrected claims); demo users must re-login to pick them up.Server-side enforcement is unchanged — these gates are UX, the API remains the authority.
Testing
tenants/branding.spec.tsfailure that reproduces with these changes stashed (unrelated flake).tsc --noEmit+ ESLint clean for both apps; DbMigrator builds with 0 warnings.🤖 Generated with Claude Code