Skip to content

Commit 9b5438d

Browse files
Fix: rolebindingRolePodExecAttach check (#1070)
* Fix: rolebindingRolePodExecAttach check Fix the case of a RoleBinding that points to a ClusterRole. In that case, we ignore the RoleBinding since it will be evaluated by the rolebindingClusterRolePodExecAttach check. * add tests for role-binding that uses a cluster-role binding --------- Co-authored-by: Vitor Vezani <[email protected]>
1 parent be349a8 commit 9b5438d

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

pkg/config/checks/rolebindingRolePodExecAttach.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ schemaString: |
1717
const: "rbac.authorization.k8s.io"
1818
kind:
1919
type: string
20-
const: "Role"
20+
const: "ClusterRole"
2121
# Do not alert on default RoleBindings.
2222
- required: ["metadata"]
2323
properties:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
name: all-operations
5+
rules:
6+
- apiGroups: ["*"]
7+
resources: ["*"]
8+
verbs: ["*"]
9+
---
10+
apiVersion: rbac.authorization.k8s.io/v1
11+
kind: RoleBinding
12+
metadata:
13+
name: all-operations
14+
namespace: my-namespace
15+
subjects:
16+
- kind: User
17+
name: example-user
18+
apiGroup: rbac.authorization.k8s.io
19+
roleRef:
20+
kind: ClusterRole
21+
name: all-operations
22+
apiGroup: rbac.authorization.k8s.io

0 commit comments

Comments
 (0)