This commit is contained in:
Br1an 2026-03-14 10:15:48 +08:00 committed by GitHub
commit 94ea2af6b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View File

@ -179,7 +179,9 @@ func regexpForRule(rule options.URLParameterRule) string {
func (p *ProviderData) setAllowedGroups(groups []string) {
p.AllowedGroups = make(map[string]struct{}, len(groups))
for _, group := range groups {
p.AllowedGroups[group] = struct{}{}
if group != "" {
p.AllowedGroups[group] = struct{}{}
}
}
}

View File

@ -102,6 +102,18 @@ func TestProviderDataAuthorize(t *testing.T) {
groups: []string{"baz", "foo"},
expectedAuthZ: false,
},
{
name: "AllowedGroupsWithEmptyString",
allowedGroups: []string{"group2", ""},
groups: []string{"group1", "group2"},
expectedAuthZ: true,
},
{
name: "AllowedGroupsOnlyEmptyString",
allowedGroups: []string{""},
groups: []string{"group1", "group2"},
expectedAuthZ: true,
},
}
for _, tc := range testCases {