-
Notifications
You must be signed in to change notification settings - Fork 697
HELM-613: Reject basic auth over non-HTTPS for Helm chart repositories #16317
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -531,6 +531,7 @@ func TestHelmRepoGetter_unmarshallConfig(t *testing.T) { | |
| createSecret bool | ||
| namespace string | ||
| createNamespace bool | ||
| clusterScoped bool | ||
| }{ | ||
| { | ||
| name: "Namespace present", | ||
|
|
@@ -558,6 +559,7 @@ func TestHelmRepoGetter_unmarshallConfig(t *testing.T) { | |
| createSecret: true, | ||
| namespace: "testing", | ||
| createNamespace: true, | ||
| clusterScoped: false, | ||
| }, | ||
| { | ||
| name: "Namespace not present", | ||
|
|
@@ -583,6 +585,61 @@ func TestHelmRepoGetter_unmarshallConfig(t *testing.T) { | |
| wantsErr: false, | ||
| createSecret: true, | ||
| createNamespace: false, | ||
| clusterScoped: false, | ||
| }, | ||
| { | ||
| name: "Basic auth is not supported for http repositories - cluster scope", | ||
| helmCRS: &unstructured.Unstructured{ | ||
| Object: map[string]interface{}{ | ||
| "apiVersion": "helm.openshift.io/v1beta1", | ||
| "kind": "HelmChartRepository", | ||
| "metadata": map[string]interface{}{ | ||
| "namespace": "", | ||
| "name": "repo6", | ||
| }, | ||
| "spec": map[string]interface{}{ | ||
| "connectionConfig": map[string]interface{}{ | ||
| "url": "http://localhost:9553", | ||
| "basicAuthConfig": map[string]interface{}{ | ||
| "name": "fooSecret", | ||
| "namespace": "testing", | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| repoName: "repo6", | ||
| wantsErr: true, | ||
| createSecret: false, | ||
| createNamespace: false, | ||
| clusterScoped: true, | ||
| }, | ||
| { | ||
| name: "Basic auth is supported only for https respositories", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As Code Rabbit pointed out, you've got an extra 's' in "repositories", here. |
||
| helmCRS: &unstructured.Unstructured{ | ||
| Object: map[string]interface{}{ | ||
| "apiVersion": "helm.openshift.io/v1beta1", | ||
| "kind": "ProjectHelmChartRepository", | ||
| "metadata": map[string]interface{}{ | ||
| "namespace": "", | ||
| "name": "repo4", | ||
| }, | ||
| "spec": map[string]interface{}{ | ||
| "connectionConfig": map[string]interface{}{ | ||
| "url": "http://localhost:9553", | ||
| "basicAuthConfig": map[string]interface{}{ | ||
| "name": "fooSecret", | ||
| "namespace": "testing", | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| repoName: "repo7", | ||
| wantsErr: true, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I concur with Code Rabbit that it would be better if Since none of the existing test cases test error paths, it wouldn't be too hard to make this change. |
||
| createSecret: false, | ||
| createNamespace: false, | ||
| clusterScoped: false, | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
|
|
@@ -610,7 +667,7 @@ func TestHelmRepoGetter_unmarshallConfig(t *testing.T) { | |
| Client: fake.K8sDynamicClient("helm.openshift.io/v1beta1", "HelmChartRepository", ""), | ||
| CoreClient: k8sfake.NewSimpleClientset(objs...).CoreV1(), | ||
| } | ||
| _, err := repoGetter.unmarshallConfig(*tt.helmCRS, tt.namespace, false) | ||
| _, err := repoGetter.unmarshallConfig(*tt.helmCRS, tt.namespace, tt.clusterScoped) | ||
| if tt.wantsErr { | ||
| require.Error(t, err) | ||
| } else { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.