Skip to content

fix(substrate): limit Substrate views to watched namespaces - #3248

Open
danielle-mustillo wants to merge 2 commits into
kagent-dev:mainfrom
danielle-mustillo:danielle-mustillo/tenantScope
Open

danielle-mustillo wants to merge 2 commits into
kagent-dev:mainfrom
danielle-mustillo:danielle-mustillo/tenantScope

Conversation

@danielle-mustillo

@danielle-mustillo danielle-mustillo commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Description

Lines Added Removed
Code 197 73
Tests 681 37
Generated 26 12
Docs 7 5

Problem

A kagent API user on a controller that watched some namespaces could read the Substrate data of other namespaces:

  • A request for an unwatched atespace or namespace returned the actors, templates, workers and counts of that namespace.
  • A request with an empty atespace returned the actors and templates of all namespaces.
  • The "next page" token could hold the name of an actor or worker in an unwatched namespace.

Resolution

The controller now returns only the Substrate data of its watched namespaces:

  • A request for an unwatched atespace or namespace now gets PermissionDenied.
  • A request with an empty atespace now returns only the data of the watched namespaces, one page at a time.
  • The "next page" token now names only data in the watched namespaces.

A controller that watches all namespaces works as before.

User Experience

A kagent API user on a controller that watches ns-a can now share one Substrate with other teams and read only the ns-a actors, templates and workers.

grpcurl -d '{"atespace":"ns-b"}' <controller> kagent.api.v1.SystemService/ListSubstrateActors
→ PermissionDenied

Changes

Request to a controller that watches ns-a Before After (new 🆕)
Actors, workers or summary for ns-b ns-b data PermissionDenied
Actors or summary with an empty atespace Data of all namespaces ns-a data only
Workers with an empty namespace One Substrate page, filtered All Substrate workers read, then only ns-a workers returned, in worker name order
"Next page" token Substrate token, can name an ns-b row kagent token, names only ns-a data
UI atespace filter placeholder "All atespaces" "All watched atespaces"

Upgrade note: an actor page token from a controller before this change, or a bad token, gets InvalidArgument. Reload the UI page, or send the API request without the token.

Limits

  • A user who calls ate-api directly, without the controller, is not stopped by this change.
  • Each actor page makes one Substrate call for each watched namespace.
  • The workers view reads the workers of all namespaces on each request and filters them in kagent. It takes about 100 ms at 10k workers, until ate-api can filter workers by namespace.
  • Possible upstream follow-ups: a namespace filter on ListWorkers, one list call for a set of atespaces, and per-row checks or authz enforcement in ate-api.

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Oct 16, 2026
@danielle-mustillo
danielle-mustillo marked this pull request as ready for review October 16, 2026 21:00
@danielle-mustillo
danielle-mustillo requested a review from a team as a code owner October 16, 2026 21:00
@danielle-mustillo
danielle-mustillo force-pushed the danielle-mustillo/tenantScope branch from cce5f8f to 4c00c04 Compare October 16, 2026 21:02
- fix(substrate): limit Substrate views to watched namespaces
- docs(substrate): say empty atespace lists watched atespaces
- test(substrate): page tokens must name only watched data
- fix(substrate): page only through watched namespaces
- fix(substrate): time out GetWorker and read worker pods uncached
- refactor(substrate): simplify page tokens and tests

Signed-off-by: Danielle Mustillo <danielle.mustillo@solo.io>
- refactor(substrate): read workers through ate-api only
- test(substrate): drop pod checks from the pass-through test
- refactor(substrate): one worker walk for both scopes
- test(substrate): drop duplicate worker tests
- refactor(substrate): cap only actor tokens and drop duplicate tests
- docs(ui): describe Substrate paging for watched namespaces
- test(substrate): trim paging tests to unique branches

Signed-off-by: Danielle Mustillo <danielle.mustillo@solo.io>
@danielle-mustillo
danielle-mustillo force-pushed the danielle-mustillo/tenantScope branch from 4c00c04 to 7990b53 Compare October 16, 2026 21:10
@danielle-mustillo danielle-mustillo self-assigned this Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant