Skip to content

Commit a9ceca0

Browse files
committed
Merge branch 'dev' of https://github.com/projectdiscovery/tlsx into dev
2 parents 76c3f99 + 72f1c5d commit a9ceca0

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

pkg/tlsx/clients/clients.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,13 @@ func IsMisMatchedCert(host string, alternativeNames []string) bool {
360360
// match leftmost token
361361
matched = matchWildCardToken(token, hostTokens[i])
362362
if !matched {
363-
return true
363+
break
364364
}
365365
} else {
366366
// match all other tokens
367367
matched = stringsutil.EqualFoldAny(token, hostTokens[i])
368368
if !matched {
369-
return true
369+
break
370370
}
371371
}
372372
}

pkg/tlsx/clients/clients_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010

1111
func TestIsMisMatchedCert(t *testing.T) {
1212
type args struct {
13-
host string
14-
names []string
13+
host string // actual host name
14+
names []string // cert names + alternate names
1515
}
1616

1717
tests := []struct {
@@ -28,6 +28,10 @@ func TestIsMisMatchedCert(t *testing.T) {
2828
{args{host: "foobaz.example.net", names: []string{"*baz.example.net"}}, false},
2929
{args{host: "buzz.example.net", names: []string{"b*z.example.net"}}, false},
3030

31+
// multilevel domains
32+
{args{host: "xyz.subdomain.target.com", names: []string{"*.target.com"}}, true},
33+
{args{host: "xyz.subdomain.target.com", names: []string{"*.subdomain.target.com"}}, false},
34+
3135
// negative scenarios
3236
{args{host: "bar.foo.example.net", names: []string{"*.example.net"}}, true},
3337
{args{host: "target.com", names: []string{"other-target.com"}}, true},

0 commit comments

Comments
 (0)