fix: disallow newer policies, users & groups with space characters (#14845)

space characters at the beginning or at the end can lead to
confusion under various UI elements in differentiating the
actual name of "policy, user or group" - to avoid this behavior
this PR onwards we shall reject such inputs for newer entries.

existing saved entries will behave as is and are going to be
operable until they are removed/renamed to something more
meaningful.
This commit is contained in:
Harshavardhana
2022-05-02 09:27:35 -07:00
committed by GitHub
parent 2719f1efaa
commit 16bc11e72e
5 changed files with 49 additions and 8 deletions

View File

@@ -158,8 +158,7 @@ type MappedPolicy struct {
func (mp MappedPolicy) toSlice() []string {
var policies []string
for _, policy := range strings.Split(mp.Policies, ",") {
policy = strings.TrimSpace(policy)
if policy == "" {
if strings.TrimSpace(policy) == "" {
continue
}
policies = append(policies, policy)