Skip to content

Expose a per-instance my/routes authorization manifest#5538

Open
WilliamBZA wants to merge 8 commits into
authfrom
add-mypermissions-endpoint
Open

Expose a per-instance my/routes authorization manifest#5538
WilliamBZA wants to merge 8 commits into
authfrom
add-mypermissions-endpoint

Conversation

@WilliamBZA

@WilliamBZA WilliamBZA commented Jun 16, 2026

Copy link
Copy Markdown
Member

What

Adds GET /api/my/routes, served by every instance (Primary, Audit, Monitoring). It returns the concrete set of API routes the current token is allowed to call, as [{ "method", "urlTemplate" }] entries.

This is the authorization contract between ServiceControl and clients (ServicePulse): each instance advertises only the routes it actually serves and the caller is actually permitted to reach. The client matches its outgoing requests against that set and never learns ServiceControl's internal instance:resource:action permission vocabulary.

Also in this PR

  • Adds an admin role between reader and writer: read-all plus full management of config/admin-area resources (licensing, notifications, redirects, throughput, connections), but not the message-triage write actions (retry/edit/archive/restore). Roles are wildcard patterns expanded once into frozen sets for O(1), allocation-free per-request checks.

Comment thread src/ServiceControl/Infrastructure/WebApi/MeController.cs Outdated
Comment thread src/ServiceControl/Infrastructure/WebApi/MeController.cs Outdated
Comment thread src/ServiceControl/Infrastructure/WebApi/MeController.cs Outdated
Comment thread src/ServiceControl/Infrastructure/WebApi/MeController.cs Outdated
@WilliamBZA WilliamBZA force-pushed the add-mypermissions-endpoint branch from fab6197 to 8b27f70 Compare June 19, 2026 08:35
WilliamBZA and others added 4 commits June 19, 2026 10:54
The /api/my/permissions/all endpoint serializes PermissionsDescriptor
whose Permissions property is IReadOnlySet<string>. System.Text.Json
cannot deserialize into an interface, so the acceptance tests that read
the response back threw NotSupportedException. Introduce a shared
PermissionsResponse DTO with a concrete HashSet<string> and use it from
both When_my_permissions_are_requested and
When_role_based_authorization_is_disabled. The production API contract
(IReadOnlySet) is unchanged.
@ramonsmits ramonsmits force-pushed the add-mypermissions-endpoint branch from 1d5fc10 to 3218b8b Compare June 22, 2026 09:20
ramonsmits added a commit that referenced this pull request Jun 26, 2026
Alternative to #5538. Instead of leaking internal permission strings to
ServicePulse, expose the concrete set of API routes the caller is allowed to
reach, so the UI gates on a stable route contract rather than coupling to the
permission catalogue.

- Project the ASP.NET EndpointDataSource into a route⇒permission table and
  resolve per-request effective permissions, filtering the manifest to the
  routes the caller can reach.
- Add the my/routes controller (served by every instance), route template
  normalization, and the manifest DTOs.
- Remove the my/permissions endpoint, MeController, PermissionsResponse and
  the root-doc permission fields.
- Add an admin role (read-all + manage config/admin-area resources, no
  message-triage write actions), sitting between reader and writer.
- Acceptance, infrastructure and approval tests for the new surface, plus an
  anti-drift policy guard.
Instead of leaking internal permission strings to
ServicePulse, expose the concrete set of API routes the caller is allowed to
reach, so the UI gates on a stable route contract rather than coupling to the
permission catalogue.

- Project the ASP.NET EndpointDataSource into a route⇒permission table and
  resolve per-request effective permissions, filtering the manifest to the
  routes the caller can reach.
- Add the my/routes controller (served by every instance), route template
  normalization, and the manifest DTOs.
- Remove the my/permissions endpoint, MeController, PermissionsResponse and
  the root-doc permission fields.
- Add an admin role (read-all + manage config/admin-area resources, no
  message-triage write actions), sitting between reader and writer.
- Acceptance, infrastructure and approval tests for the new surface, plus an
  anti-drift policy guard.
@ramonsmits ramonsmits changed the title Add mypermissions endpoint Expose a per-instance my/routes authorization manifest Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants