Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Operator RBAC Permissions are overly broad #173

Closed
1 task done
adambkaplan opened this issue Nov 6, 2023 · 0 comments · Fixed by #172
Closed
1 task done

[BUG] Operator RBAC Permissions are overly broad #173

adambkaplan opened this issue Nov 6, 2023 · 0 comments · Fixed by #172
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@adambkaplan
Copy link
Member

adambkaplan commented Nov 6, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Kubernetes Version

Kubernetes 1.24 or higher.

Shipwright Version

v0.12.0

Current Behavior

The Shipwright operator is granted RBAC permissions that are incredibly broad - it is effectively granted permission to be the "admin" over any workload and service account. This poses a security risk if the operator's service account token is leaked/exposed.

Snippet from kubectl describe clusterrole that is generated by OLM for the operator:

  Resources                                                             Non-Resource URLs  Resource Names                          Verbs
  ---------                                                             -----------------  --------------                          -----
  events                                                                []                 []                                      [create delete get list patch update watch]
  limitranges                                                           []                 []                                      [create delete get list patch update watch]
  namespaces                                                            []                 []                                      [create delete get list patch update watch]
  services                                                              []                 []                                      [create delete get list patch update watch]
  validatingwebhookconfigurations.admissionregistration.k8s.io/v1beta1  []                 []                                      [create delete get list patch update watch]
  validatingwebhookconfigurations.admissionregistration.k8s.io          []                 []                                      [create delete get list patch update watch]
  pods                                                                  []                 []                                      [get list watch create delete patch update]
  secrets                                                               []                 []                                      [get list watch create delete patch update]
  configmaps                                                            []                 []                                      [list get create update delete patch watch]

Expected Behavior

The operator's service account should adhere to the "principle of least privilege" - it should only be granted the minimal set of RBAC permissions to operate, and nothing more.

Some Kubernetes admission controllers (that are enabled by default in some distributions) can expand what is required for "least privilege":

Steps To Reproduce

  1. Deploy the Shipwright operator v0.12.0.
  2. Inspect the permissions granted to the operator's service account.

Anything else?

Introduced in 64baf78

@adambkaplan adambkaplan added the kind/bug Categorizes issue or PR as related to a bug. label Nov 6, 2023
@adambkaplan adambkaplan added this to the release-v0.13.0 milestone Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant