Do not consider environment variables from viper for CLI commands #12
Copy link
Copy link
Open
Description
At the moment, a user can export env variables, which will then be available through viper and impact a lot of code, like:
// from admin/v1/tenant.go
...
if viper.IsSet("admitted") {
req.Admitted = pointer.Pointer(viper.GetBool("admitted"))
}
if viper.IsSet("limit") {
req.Paging = &apiv1.Paging{
Count: pointer.Pointer(viper.GetUint64("limit")),
Page: nextpage,
}
}
if viper.IsSet("provider") {
return nil, fmt.Errorf("unimplemented filter by provider")
}So if a user exports METAL_STACK_CLOUD_ADMITTED it will influence the output of the command, which I do not think should be possible. In this example it is maybe not so dangerous but for deletion or update commands this could lead to unexpected problems. We should therefore only consider --admitted parsed directly from the command line.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity