Avoid exposing sensitive data to client (#1543)
This PR changes the behavior of controller API which wrongly exposes sensitive data to the client. Now, the API only returns success if secret/configmap exists; otherwise, an error will be returned.
This commit is contained in:
@@ -222,7 +222,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
// check the referenced secret is in the same ns as the function, if not give a warning.
|
||||
if !toSpec { // TODO: workaround in order not to block users from creating function spec, remove it.
|
||||
for _, secretName := range secretNames {
|
||||
_, err := opts.Client().V1().Misc().SecretGet(&metav1.ObjectMeta{
|
||||
err := opts.Client().V1().Misc().SecretExists(&metav1.ObjectMeta{
|
||||
Namespace: fnNamespace,
|
||||
Name: secretName,
|
||||
})
|
||||
@@ -248,7 +248,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
// check the referenced cfgmap is in the same ns as the function, if not give a warning.
|
||||
if !toSpec {
|
||||
for _, cfgMapName := range cfgMapNames {
|
||||
_, err := opts.Client().V1().Misc().ConfigMapGet(&metav1.ObjectMeta{
|
||||
err := opts.Client().V1().Misc().ConfigMapExists(&metav1.ObjectMeta{
|
||||
Namespace: fnNamespace,
|
||||
Name: cfgMapName,
|
||||
})
|
||||
|
||||
@@ -87,7 +87,7 @@ func (opts *UpdateSubCommand) complete(input cli.Input) error {
|
||||
|
||||
// check that the referenced secret is in the same ns as the function, if not give a warning.
|
||||
for _, secretName := range secretNames {
|
||||
_, err := opts.Client().V1().Misc().SecretGet(&metav1.ObjectMeta{
|
||||
err := opts.Client().V1().Misc().SecretExists(&metav1.ObjectMeta{
|
||||
Namespace: fnNamespace,
|
||||
Name: secretName,
|
||||
})
|
||||
@@ -111,7 +111,7 @@ func (opts *UpdateSubCommand) complete(input cli.Input) error {
|
||||
|
||||
// check that the referenced cfgmap is in the same ns as the function, if not give a warning.
|
||||
for _, cfgMapName := range cfgMapNames {
|
||||
_, err := opts.Client().V1().Misc().ConfigMapGet(&metav1.ObjectMeta{
|
||||
err := opts.Client().V1().Misc().ConfigMapExists(&metav1.ObjectMeta{
|
||||
Namespace: fnNamespace,
|
||||
Name: cfgMapName,
|
||||
})
|
||||
|
||||
@@ -400,7 +400,7 @@ func (fr *FissionResources) Validate(input cli.Input) ([]string, error) {
|
||||
return warnings, err
|
||||
}
|
||||
for _, cm := range f.Spec.ConfigMaps {
|
||||
_, err := client.V1().Misc().ConfigMapGet(&metav1.ObjectMeta{
|
||||
err := client.V1().Misc().ConfigMapExists(&metav1.ObjectMeta{
|
||||
Name: cm.Name,
|
||||
Namespace: cm.Namespace,
|
||||
})
|
||||
@@ -410,7 +410,7 @@ func (fr *FissionResources) Validate(input cli.Input) ([]string, error) {
|
||||
}
|
||||
|
||||
for _, s := range f.Spec.Secrets {
|
||||
_, err := client.V1().Misc().SecretGet(&metav1.ObjectMeta{
|
||||
err := client.V1().Misc().SecretExists(&metav1.ObjectMeta{
|
||||
Name: s.Name,
|
||||
Namespace: s.Namespace,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user