Skip to content

Commit 9a13145

Browse files
committed
Adding quotes around client cert CNs and escaping special characters.
Signed-off-by: Mahdi Ramezani <mramezani@microsoft.com>
1 parent dbe49a9 commit 9a13145

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

go-server-server/go/auth.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"log"
55
"net/http"
66
"strings"
7+
"strconv"
78
)
89

910
func CommonNameMatch(r *http.Request) bool {
@@ -44,7 +45,7 @@ func CommonNameMatch(r *http.Request) bool {
4445

4546
commonNames := make([]string, 0)
4647
for _, peercert := range r.TLS.PeerCertificates {
47-
commonNames = append(commonNames, peercert.Subject.CommonName)
48+
commonNames = append(commonNames, strconv.Quote(peercert.Subject.CommonName))
4849
}
4950
log.Printf("error: Authentication Failed! None of the common names in the client cert chain" +
5051
" matched any of the trusted common names. Client cert common names: %v", commonNames)

0 commit comments

Comments
 (0)