Skip to content

Commit e23c1a9

Browse files
jopemachineclaude
andcommitted
refactor(BA-6891): run kernel admin history search as a global action
The admin search is system-wide and unscoped, so its authorization is the SUPERADMIN role gate rather than RBAC scope resolution. That is what BaseGlobalAction and GlobalActionProcessor model, and the processor applies the gate on the action path as defense in depth behind the route's superadmin_required middleware. The scoped counterpart is unchanged: it resolves against an RBAC scope and stays on the plain action path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 30e5c96 commit e23c1a9

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/ai/backend/manager/services/scheduling_history/actions/search_kernel_history.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@
55

66
from ai.backend.common.data.permission.types import EntityType
77
from ai.backend.manager.actions.action import BaseActionResult
8+
from ai.backend.manager.actions.action.global_action import BaseGlobalAction
89
from ai.backend.manager.actions.types import ActionOperationType
910
from ai.backend.manager.data.kernel.types import KernelSchedulingHistoryData
1011
from ai.backend.manager.repositories.base import BatchQuerier
1112

12-
from .base import SchedulingHistoryAction
13-
1413

1514
@dataclass
16-
class SearchKernelHistoryAction(SchedulingHistoryAction):
17-
"""Action to search kernel scheduling history (admin API)."""
15+
class SearchKernelHistoryAction(BaseGlobalAction):
16+
"""Action to search kernel scheduling history (admin API).
17+
18+
System-wide and unscoped: authorization is the SUPERADMIN role gate rather
19+
than RBAC scope resolution, so this runs through ``GlobalActionProcessor``.
20+
The scoped counterpart stays on the RBAC path.
21+
"""
1822

1923
querier: BatchQuerier
2024

src/ai/backend/manager/services/scheduling_history/processors.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from ai.backend.manager.actions.monitors.monitor import ActionMonitor
66
from ai.backend.manager.actions.processor import ActionProcessor
7+
from ai.backend.manager.actions.processor.global_action import GlobalActionProcessor
78
from ai.backend.manager.actions.types import AbstractProcessorPackage, ActionSpec
89
from ai.backend.manager.actions.validators import ActionValidators
910

@@ -35,7 +36,7 @@ class SchedulingHistoryProcessors(AbstractProcessorPackage):
3536
search_session_history: ActionProcessor[
3637
SearchSessionHistoryAction, SearchSessionHistoryActionResult
3738
]
38-
search_kernel_history: ActionProcessor[
39+
search_kernel_history: GlobalActionProcessor[
3940
SearchKernelHistoryAction, SearchKernelHistoryActionResult
4041
]
4142
search_deployment_history: ActionProcessor[
@@ -67,7 +68,9 @@ def __init__(
6768
self.search_session_history = ActionProcessor(
6869
service.search_session_history, action_monitors
6970
)
70-
self.search_kernel_history = ActionProcessor(service.search_kernel_history, action_monitors)
71+
self.search_kernel_history = GlobalActionProcessor(
72+
service.search_kernel_history, action_monitors
73+
)
7174
self.search_deployment_history = ActionProcessor(
7275
service.search_deployment_history, action_monitors
7376
)

0 commit comments

Comments
 (0)