Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

fix: use a LocalObjectReference for credentials Secret #37

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

dkoshkin
Copy link
Collaborator

@dkoshkin dkoshkin commented Apr 8, 2024

Using a cross-namespace objectRef in the cluster API can lead to privilege escalation.
A user with RBAC to read Secrets in one namespace can create a cluster, and copy any Secret from any other namespace to their workload cluster.

Using a cross-namespace objectRef in the cluster API
can lead to privilege escalation.
A user with RBAC to read Secrets in one namespace can create a cluster,
and copy any Secret from any other namespace to their workload cluster.
@dkoshkin dkoshkin self-assigned this Apr 8, 2024
@github-actions github-actions bot added the fix label Apr 8, 2024
@faiq
Copy link

faiq commented Apr 8, 2024

Does this makes it so a user can only deploy one cluster only in the same namespace as CAREN?

@dkoshkin
Copy link
Collaborator Author

dkoshkin commented Apr 8, 2024

Does this makes it so a user can only deploy one cluster only in the same namespace as CAREN?

Good question. No, a user can deploy a Cluster in any namespace where they have RBAC permissions to create the Cluster and Secret objects, but using a local ref guarantees that a user can only copy Secrets in that same namespace.

The CAREN controller has elevated privileges, so it can still create clusters in any namespace, from 1 or multiple users.

@faiq
Copy link

faiq commented Apr 8, 2024

Good question. No, a user can deploy a Cluster in any namespace where they have RBAC permissions to create the Cluster and Secret objects, but using a local ref guarantees that a user can only copy Secrets in that same namespace.

Wouldn't the same namespace be the same namespace as the running process?

@dkoshkin
Copy link
Collaborator Author

dkoshkin commented Apr 8, 2024

Good question. No, a user can deploy a Cluster in any namespace where they have RBAC permissions to create the Cluster and Secret objects, but using a local ref guarantees that a user can only copy Secrets in that same namespace.

Wouldn't the same namespace be the same namespace as the running process?

I may misunderstanding, but by the "same namespace" I meant same namespace as the Cluster.
Notice the Secret that CAREN is trying to read it from is using the Cluster Namespace: req.Cluster.Namespace,
https://github.com/d2iq-labs/cluster-api-runtime-extensions-nutanix/pull/37/files#diff-174d511aea21d4b975137ea0502067a5cb1b145fe839dbe8fa12d1fc618e1b76R91

Copy link

@supershal supershal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Lets start creating unit tests for add-on handlers. I will create issue if its not already there.

@dkoshkin dkoshkin merged commit cb8fadb into main Apr 9, 2024
16 of 19 checks passed
@dkoshkin dkoshkin deleted the dkoshkin/fix-ccm-credentials-ref-type branch April 9, 2024 15:29
@github-actions github-actions bot mentioned this pull request Apr 9, 2024
jimmidyson pushed a commit that referenced this pull request Apr 11, 2024
Using a cross-namespace objectRef in the cluster API
can lead to privilege escalation.
A user with RBAC to read Secrets in one namespace can create a cluster,
and copy any Secret from any other namespace to their workload cluster.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants