From 7a94b0c1570e9b0ad60bb8eadfb3d80e75b5b3e7 Mon Sep 17 00:00:00 2001 From: Fearghal O Floinn Date: Wed, 8 Sep 2021 12:24:49 +0100 Subject: [PATCH] Converts group and subgroup to lowercase for comparison. Fixes #679 --- authority/provisioner/sign_ssh_options.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/authority/provisioner/sign_ssh_options.go b/authority/provisioner/sign_ssh_options.go index a872513e..4a0cf526 100644 --- a/authority/provisioner/sign_ssh_options.go +++ b/authority/provisioner/sign_ssh_options.go @@ -5,6 +5,7 @@ import ( "encoding/binary" "encoding/json" "math/big" + "strings" "time" "github.com/pkg/errors" @@ -453,12 +454,20 @@ func containsAllMembers(group, subgroup []string) bool { if lsg > lg || (lg > 0 && lsg == 0) { return false } + groupLower := []string{} + subgroupLower := []string{} + for _, s := range group { + groupLower = append(groupLower, strings.ToLower(s)) + } + for _, s := range subgroup { + subgroupLower = append(subgroupLower, strings.ToLower(s)) + } visit := make(map[string]struct{}, lg) for i := 0; i < lg; i++ { - visit[group[i]] = struct{}{} + visit[groupLower[i]] = struct{}{} } for i := 0; i < lsg; i++ { - if _, ok := visit[subgroup[i]]; !ok { + if _, ok := visit[subgroupLower[i]]; !ok { return false } }