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

Commit 5dbf460

Browse files
dkoshkinjimmidyson
authored andcommitted
fix: use a LocalObjectReference for credentials Secret (#37)
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.
1 parent 1bb01c2 commit 5dbf460

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

api/v1alpha1/addon_types.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ type CSIProvider struct {
164164
Strategy AddonStrategy `json:"strategy"`
165165

166166
// +optional
167-
Credentials *corev1.SecretReference `json:"credentials,omitempty"`
167+
Credentials *corev1.LocalObjectReference `json:"credentials,omitempty"`
168168
}
169169

170170
type StorageClassConfig struct {
@@ -257,9 +257,6 @@ func (CSIProvider) VariableSchema() clusterv1.VariableSchema {
257257
"name": {
258258
Type: "string",
259259
},
260-
"namespace": {
261-
Type: "string",
262-
},
263260
},
264261
},
265262
"storageClassConfig": {

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/handlers/generic/lifecycle/csi/nutanix-csi/handler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ func (n *NutanixCSI) Apply(
8787
Kind: "Secret",
8888
},
8989
ObjectMeta: metav1.ObjectMeta{
90-
Namespace: provider.Credentials.Name,
91-
Name: provider.Credentials.Namespace,
90+
Name: provider.Credentials.Name,
91+
Namespace: req.Cluster.Namespace,
9292
},
9393
}
9494
err := n.client.Get(

0 commit comments

Comments
 (0)