Skip to content

Commit

Permalink
Removed write permissions for auditor role.
Browse files Browse the repository at this point in the history
The auditor role had excess permissions on pods in a cluster.
  • Loading branch information
josephlewis42 committed Sep 25, 2023
1 parent 9fd629e commit 5deae53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 0 additions & 3 deletions config/200-user-roles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ rules:
- apiGroups: ["apps"]
resources: ["deployments"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["pods/exec", "pods/attach"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get", "list", "watch"]
Expand Down
12 changes: 12 additions & 0 deletions pkg/kf/commands/spaces/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,18 @@ func verifyAuditorPermission(ctx context.Context, t *testing.T, namespace string
{title: "SpaceAuditor can not update secrets in space", space: namespace, verb: "update", group: "", resource: "secrets", expectedOutput: false},
{title: "SpaceAuditor can not patch secrets in space", space: namespace, verb: "patch", group: "", resource: "secrets", expectedOutput: false},
{title: "SpaceAuditor can not delete secrets in space", space: namespace, verb: "delete", group: "", resource: "secrets", expectedOutput: false},

// Auditors shouldn't have any access on exec/attach.
// https://github.com/kubernetes/kubernetes/issues/78741
// https://kubernetes.io/docs/reference/access-authn-authz/authorization/#determine-the-request-verb
{title: "SpaceAuditor can not exec to Pods in space", space: namespace, verb: "create", group: "", resource: "pods/exec", expectedOutput: false},
{title: "SpaceAuditor can not exec to Pods in space", space: namespace, verb: "get", group: "", resource: "pods/exec", expectedOutput: false},
{title: "SpaceAuditor can not exec to Pods in space", space: namespace, verb: "list", group: "", resource: "pods/exec", expectedOutput: false},
{title: "SpaceAuditor can not exec to Pods in space", space: namespace, verb: "watch", group: "", resource: "pods/exec", expectedOutput: false},
{title: "SpaceAuditor can not attach to Pods in space", space: namespace, verb: "create", group: "", resource: "pods/attach", expectedOutput: false},
{title: "SpaceAuditor can not attach to Pods in space", space: namespace, verb: "get", group: "", resource: "pods/attach", expectedOutput: false},
{title: "SpaceAuditor can not attach to Pods in space", space: namespace, verb: "list", group: "", resource: "pods/attach", expectedOutput: false},
{title: "SpaceAuditor can not attach to Pods in space", space: namespace, verb: "watch", group: "", resource: "pods/attach", expectedOutput: false},
}

for _, test := range tests {
Expand Down

0 comments on commit 5deae53

Please sign in to comment.