feat(api-keys): add platform-scoped API keys for control-plane automation
Introduce platform API keys with capability-based access to tenant management, system settings, runtime queues, and audit logs, plus admin UI for key lifecycle and system audit log viewing.
This commit is contained in:
@@ -55,6 +55,17 @@ func TestRequireSystemAdmin_RejectsAPIKey(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRequireSystemAdmin_AllowsPlatformAPIKeyAfterRouteGate(t *testing.T) {
|
||||
w := apiKeyRBACHarness(
|
||||
types.TenantAPIKeyScope{ScopeType: types.APIKeyScopePlatform},
|
||||
types.TenantRoleViewer,
|
||||
RequireSystemAdmin(cfgRBAC(true)),
|
||||
)
|
||||
if w.Code != http.StatusOK {
|
||||
t.Fatalf("platform API key should pass the system-admin role guard after route authorization, got %d", w.Code)
|
||||
}
|
||||
}
|
||||
|
||||
// TestRequireOwnershipOrRole_ShortCircuitsAPIKey is the core regression for
|
||||
// review #1: an API key writing to a KB it does not
|
||||
// "own" (synthetic system user never matches creator_id) must not be 403'd by
|
||||
|
||||
Reference in New Issue
Block a user