2.5 KiB
2.5 KiB
Efemeryczny RBAC per-run
#sympozium #security #rbac
Koncepcja
Odpowiednik temporary IAM session credentials w Kubernetes (patrz RBAC dla wyjaśnienia systemu). Credentials istnieją TYLKO przez czas trwania AgentRun.
Lifecycle
AgentRun CREATED
↓
Controller tworzy:
├── Role (namespace-scoped)
│ ├── ownerRef → AgentRun
│ └── rules: [z SkillPack.sidecar.rbac]
├── RoleBinding
│ ├── ownerRef → AgentRun
│ └── subject → ServiceAccount "sympozium-agent"
├── ClusterRole (cluster-scoped)
│ ├── labels: sympozium.ai/agentrun: <name>
│ └── rules: [z SkillPack.sidecar.clusterRBAC]
└── ClusterRoleBinding
├── labels: sympozium.ai/agentrun: <name>
└── subject → ServiceAccount "sympozium-agent"
↓
[CREDENTIALS ACTIVE - sidecar can use them]
↓
AgentRun COMPLETED
↓
Controller czyści:
├── Namespace RBAC → auto via ownerReference (K8s GC)
└── Cluster RBAC → manual via label selector (controller)
↓
[CREDENTIALS DELETED - no standing access]
Dlaczego nie standing role?
Problem standing god-role:
ServiceAccount z cluster-admin → ZAWSZE ma pełne uprawnienia
→ Compromised pod = pełny dostęp do klastra
→ Brak auditu "kto kiedy co robił"
Ephemeral RBAC:
Run #1: Role [get pods] → exists for 30s → deleted
Run #2: Role [get deployments] → exists for 45s → deleted
→ Credentials istnieją minimum possible time
→ Każdy run ma TYLKO te uprawnienia które potrzebuje
→ Pełny audit trail (RBAC resources w etcd)
Controller privilege
Controller sam potrzebuje cluster-admin bo:
- Tworzy dowolne Role/ClusterRole (definiowane w SkillPacks)
- K8s RBAC escalation prevention wymaga tego
- To jedyny komponent z takimi uprawnieniami
Namespace vs Cluster scope
| Typ | Mechanizm cleanup | Scope |
|---|---|---|
| Role + RoleBinding | ownerReference → AgentRun | Namespace |
| ClusterRole + ClusterRoleBinding | Label selector → controller cleanup | Cluster |
Namespace-scoped RBAC jest automatycznie garbage-collected przez K8s gdy AgentRun jest usunięty (ownerReference chain).
Cluster RBAC nie może mieć cross-namespace ownerRef (ograniczenie K8s - patrz ownerReference), więc Controller i Reconciler czyści ręcznie po labelach.
Powiązane: Skill Sidecars i auto-RBAC | Model bezpieczeństwa Defence-in-Depth | SkillPack