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 authored and GitHub committed 2022-05-02 09:27:35 -07:00
1 parent 2719f1efaa
commit 16bc11e72e
5 files changed
+49 -8

No files matched your search

+1 -2
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)