Skip to content

Commit

Permalink
Fix: rolebindingRolePodExecAttach check (#1070)
Browse files Browse the repository at this point in the history
* 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 <vitor.vezani@fairwinds.com>
  • Loading branch information
greg5813 and vitorvezani authored Oct 2, 2024
1 parent be349a8 commit 9b5438d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/config/checks/rolebindingRolePodExecAttach.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ schemaString: |
const: "rbac.authorization.k8s.io"
kind:
type: string
const: "Role"
const: "ClusterRole"
# Do not alert on default RoleBindings.
- required: ["metadata"]
properties:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: all-operations
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: all-operations
namespace: my-namespace
subjects:
- kind: User
name: example-user
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: ClusterRole
name: all-operations
apiGroup: rbac.authorization.k8s.io

0 comments on commit 9b5438d

Please sign in to comment.