Add function to Authorizer interface to list authorized namespaces
Is your feature request related to a problem? Please describe.
Currently, the Authorizer interface (in common/authorization/authorizer.go) only exposes a single method:
type Authorizer interface {
Authorize(ctx context.Context, caller *Claims, target *CallTarget) (Result, error)
}This only allows checking whether a caller is authorized to act on a specific namespace/target. There is no way to ask the authorizer "which namespaces is this caller allowed to access?".
This becomes a real problem when using Temporal UI (or any other client) in a multi-tenant setup: when listing namespaces, the server has no way to filter the list down to only the namespaces the caller is authorized to see. As a result, callers get back the full namespace list from the registry, even if their custom Authorizer implementation would deny access to most of them. This leaks the existence/names of namespaces the caller shouldn't even know about, and forces UI/API consumers to attempt authorization checks per-namespace on the client side (or simply display namespaces they can't use).
Describe the solution you'd like
Add a new method to the Authorizer interface (or an optional extension interface) that allows listing/filtering namespaces the caller is authorized to access, for example:
type Authorizer interface {
Authorize(ctx context.Context, caller *Claims, target *CallTarget) (Result, error)
// ListAuthorizedNamespaces returns the subset of namespaces the caller is authorized to access.
ListAuthorizedNamespaces(ctx context.Context, caller *Claims, namespaces []string) ([]string, error)
}Then, the frontend ListNamespaces API (and any other place where the full namespace registry is exposed, such as endpoints used by Temporal UI) should call this new method to filter the namespace list before returning it to the caller, instead of returning the entire registry contents.
The defaultAuthorizer and noopAuthorizer implementations should provide sensible default behavior (e.g., the noop authorizer returns the full list unfiltered, and the default authorizer filters based on existing namespace-scoped claims logic).
Describe alternatives you've considered
- Filtering namespaces exclusively on the client (e.g., Temporal UI) side by calling
Authorizeonce per namespace. This is inefficient (N calls instead of 1) and doesn't prevent the server from leaking the full namespace list to any caller who inspects the raw API response. - Leaving this to be handled entirely by a custom
ClaimMapper/Authorizerimplementation without a formal interface method — this doesn't work well because there's currently no hook point in theListNamespacesflow where per-namespace filtering happens.
Additional context
This mainly affects multi-tenant deployments where a custom Authorizer restricts callers to a subset of namespaces. Today, ListNamespaces (and by extension Temporal UI's namespace picker) returns every namespace in the cluster regardless of the caller's actual permissions, which is both a UX issue (irrelevant namespaces shown) and a potential information disclosure issue (namespace names/existence leaked to unauthorized callers).
Relevant code:
common/authorization/authorizer.go— defines theAuthorizerinterface.common/authorization/default_authorizer.go— default implementation that would need to implement the new method.common/authorization/noop_authorizer.go— no-op implementation that would need to implement the new method.service/frontend/fx.go— wires up theAuthorizerandNamespaceChecker; theListNamespaceshandler would need to use the new method to filter results.
Source: temporalio/temporal