Skip to content

Commit 23963d0

Browse files
jyejarecursoragent
andauthored
fix: Operator Cluster Role grants excess permissions (feast-dev#302)
* Fix: [RHOAI 3.5] Operator Cluster Role grants excess permissions Signed-off-by: Jitendra Yejare <[email protected]> Co-authored-by: Cursor <[email protected]> * fix: Restore pods/exec create in operator manager-role for CronJob support The security hardening commit stripped pods/exec create from the operator manager-role. The CronJob feature creates a Role granting pods/exec create to the FeatureStore SA for running feast apply and materialize commands. Without this permission, Kubernetes RBAC escalation prevention blocks the Role creation. Signed-off-by: Jitendra Yejare <[email protected]> Co-authored-by: Cursor <[email protected]> * fix: Remove inert subjectaccessreviews and restore clusterrolebindings list The operator manager-role had subjectaccessreviews stripped by the security hardening commit. When the default auth was changed to kubernetes, the reconciler tries to create Roles/ClusterRoles granting subjectaccessreviews create to the FeatureStore SA. Kubernetes RBAC escalation prevention blocks this because the operator SA no longer has this permission, causing reconciliation failure. - Remove subjectaccessreviews create from both setFeastRole() and setFeastClusterRole() — it was under rbac.authorization.k8s.io (wrong API group; real SAR is authorization.k8s.io) and was inert - Add clusterrolebindings list back to the operator manager-role so the feast SA can resolve ClusterRoleBinding-based user roles via list_cluster_role_binding() in the Python SDK Signed-off-by: Jitendra Yejare <[email protected]> Co-authored-by: Cursor <[email protected]> --------- Signed-off-by: Jitendra Yejare <[email protected]> Co-authored-by: Cursor <[email protected]>
1 parent 18606e5 commit 23963d0

5 files changed

Lines changed: 111 additions & 21 deletions

File tree

‎infra/feast-operator/bundle/manifests/feast-operator.clusterserviceversion.yaml‎

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,15 @@ spec:
137137
- ""
138138
resources:
139139
- namespaces
140+
verbs:
141+
- get
142+
- list
143+
- update
144+
- watch
145+
- apiGroups:
146+
- ""
147+
resources:
140148
- pods
141-
- secrets
142149
verbs:
143150
- get
144151
- list
@@ -149,6 +156,12 @@ spec:
149156
- pods/exec
150157
verbs:
151158
- create
159+
- apiGroups:
160+
- ""
161+
resources:
162+
- secrets
163+
verbs:
164+
- get
152165
- apiGroups:
153166
- feast.dev
154167
resources:
@@ -202,10 +215,35 @@ spec:
202215
- rbac.authorization.k8s.io
203216
resources:
204217
- clusterrolebindings
218+
verbs:
219+
- create
220+
- delete
221+
- get
222+
- list
223+
- update
224+
- apiGroups:
225+
- rbac.authorization.k8s.io
226+
resources:
205227
- clusterroles
228+
verbs:
229+
- create
230+
- apiGroups:
231+
- rbac.authorization.k8s.io
232+
resourceNames:
233+
- feast-discover-namespaces
234+
- feast-oidc-token-review
235+
- feast-token-review-cluster-role
236+
resources:
237+
- clusterroles
238+
verbs:
239+
- delete
240+
- get
241+
- update
242+
- apiGroups:
243+
- rbac.authorization.k8s.io
244+
resources:
206245
- rolebindings
207246
- roles
208-
- subjectaccessreviews
209247
verbs:
210248
- create
211249
- delete

‎infra/feast-operator/config/rbac/role.yaml‎

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,12 @@ rules:
8585
verbs:
8686
- get
8787
- list
88-
- patch
8988
- update
9089
- watch
9190
- apiGroups:
9291
- ""
9392
resources:
9493
- pods
95-
- secrets
9694
verbs:
9795
- get
9896
- list
@@ -103,6 +101,12 @@ rules:
103101
- pods/exec
104102
verbs:
105103
- create
104+
- apiGroups:
105+
- ""
106+
resources:
107+
- secrets
108+
verbs:
109+
- get
106110
- apiGroups:
107111
- feast.dev
108112
resources:
@@ -164,10 +168,35 @@ rules:
164168
- rbac.authorization.k8s.io
165169
resources:
166170
- clusterrolebindings
171+
verbs:
172+
- create
173+
- delete
174+
- get
175+
- list
176+
- update
177+
- apiGroups:
178+
- rbac.authorization.k8s.io
179+
resources:
180+
- clusterroles
181+
verbs:
182+
- create
183+
- apiGroups:
184+
- rbac.authorization.k8s.io
185+
resourceNames:
186+
- feast-discover-namespaces
187+
- feast-oidc-token-review
188+
- feast-token-review-cluster-role
189+
resources:
167190
- clusterroles
191+
verbs:
192+
- delete
193+
- get
194+
- update
195+
- apiGroups:
196+
- rbac.authorization.k8s.io
197+
resources:
168198
- rolebindings
169199
- roles
170-
- subjectaccessreviews
171200
verbs:
172201
- create
173202
- delete

‎infra/feast-operator/dist/install.yaml‎

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20451,14 +20451,12 @@ rules:
2045120451
verbs:
2045220452
- get
2045320453
- list
20454-
- patch
2045520454
- update
2045620455
- watch
2045720456
- apiGroups:
2045820457
- ""
2045920458
resources:
2046020459
- pods
20461-
- secrets
2046220460
verbs:
2046320461
- get
2046420462
- list
@@ -20469,6 +20467,12 @@ rules:
2046920467
- pods/exec
2047020468
verbs:
2047120469
- create
20470+
- apiGroups:
20471+
- ""
20472+
resources:
20473+
- secrets
20474+
verbs:
20475+
- get
2047220476
- apiGroups:
2047320477
- feast.dev
2047420478
resources:
@@ -20530,10 +20534,35 @@ rules:
2053020534
- rbac.authorization.k8s.io
2053120535
resources:
2053220536
- clusterrolebindings
20537+
verbs:
20538+
- create
20539+
- delete
20540+
- get
20541+
- list
20542+
- update
20543+
- apiGroups:
20544+
- rbac.authorization.k8s.io
20545+
resources:
20546+
- clusterroles
20547+
verbs:
20548+
- create
20549+
- apiGroups:
20550+
- rbac.authorization.k8s.io
20551+
resourceNames:
20552+
- feast-discover-namespaces
20553+
- feast-oidc-token-review
20554+
- feast-token-review-cluster-role
20555+
resources:
2053320556
- clusterroles
20557+
verbs:
20558+
- delete
20559+
- get
20560+
- update
20561+
- apiGroups:
20562+
- rbac.authorization.k8s.io
20563+
resources:
2053420564
- rolebindings
2053520565
- roles
20536-
- subjectaccessreviews
2053720566
verbs:
2053820567
- create
2053920568
- delete

‎infra/feast-operator/internal/controller/authz/authz.go‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,6 @@ func (authz *FeastAuthorization) setFeastClusterRole(clusterRole *rbacv1.Cluster
149149
Resources: []string{"tokenreviews"},
150150
Verbs: []string{"create"},
151151
},
152-
{
153-
APIGroups: []string{rbacv1.GroupName},
154-
Resources: []string{"subjectaccessreviews"},
155-
Verbs: []string{"create"},
156-
},
157152
{
158153
APIGroups: []string{""},
159154
Resources: []string{"namespaces"},
@@ -235,11 +230,6 @@ func (authz *FeastAuthorization) setFeastRole(role *rbacv1.Role) error {
235230
Resources: []string{"tokenreviews"},
236231
Verbs: []string{"create"},
237232
},
238-
{
239-
APIGroups: []string{rbacv1.GroupName},
240-
Resources: []string{"subjectaccessreviews"},
241-
Verbs: []string{"create"},
242-
},
243233
{
244234
APIGroups: []string{""},
245235
Resources: []string{"namespaces"},

‎infra/feast-operator/internal/controller/featurestore_controller.go‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,14 @@ type FeatureStoreReconciler struct {
6666
// +kubebuilder:rbac:groups=feast.dev,resources=featurestores/finalizers,verbs=update
6767
// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;create;update;watch;delete
6868
// +kubebuilder:rbac:groups=core,resources=services;configmaps;persistentvolumeclaims;serviceaccounts,verbs=get;list;create;update;watch;delete
69-
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=roles;rolebindings;clusterroles;clusterrolebindings;subjectaccessreviews,verbs=get;list;create;update;watch;delete
70-
// +kubebuilder:rbac:groups=core,resources=namespaces,verbs=get;list;watch;patch;update
71-
// +kubebuilder:rbac:groups=core,resources=secrets;pods,verbs=get;list;watch
69+
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=roles;rolebindings,verbs=get;list;create;update;watch;delete
70+
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=clusterroles,verbs=create
71+
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=clusterroles,verbs=get;update;delete,resourceNames=feast-discover-namespaces;feast-token-review-cluster-role;feast-oidc-token-review
72+
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=clusterrolebindings,verbs=create;get;list;update;delete
73+
// +kubebuilder:rbac:groups=core,resources=namespaces,verbs=get;list;watch;update
74+
// +kubebuilder:rbac:groups=core,resources=pods,verbs=get;list;watch
7275
// +kubebuilder:rbac:groups=core,resources=pods/exec,verbs=create
76+
// +kubebuilder:rbac:groups=core,resources=secrets,verbs=get
7377
// +kubebuilder:rbac:groups=authentication.k8s.io,resources=tokenreviews,verbs=create
7478
// +kubebuilder:rbac:groups=route.openshift.io,resources=routes,verbs=get;list;create;update;watch;delete
7579
// +kubebuilder:rbac:groups=batch,resources=cronjobs,verbs=get;list;watch;create;update;patch;delete

0 commit comments

Comments
 (0)