diff --git a/ja4plus.go b/ja4plus.go index d362d59..1270d18 100644 --- a/ja4plus.go +++ b/ja4plus.go @@ -36,8 +36,8 @@ func JA4(hello *tls.ClientHelloInfo) string { } // Extract TLS version - supporetdVersions := slices.Sorted(slices.Values(hello.SupportedVersions)) - switch supporetdVersions[len(supporetdVersions)-1] { + supportedVersions := slices.DeleteFunc(slices.Sorted(slices.Values(hello.SupportedVersions)), greaseFilter) + switch supportedVersions[len(supportedVersions)-1] { case tls.VersionTLS10: out = append(out, '1', '0') case tls.VersionTLS11: diff --git a/ja4plus_test.go b/ja4plus_test.go index 31dcf02..6739b98 100644 --- a/ja4plus_test.go +++ b/ja4plus_test.go @@ -67,6 +67,14 @@ func TestJA4(t *testing.T) { }, expected: "t13i0002h1_000000000000_5b56ea7744b1", }, + { + name: "ClientHelloInfo with grease values in SupportedVersions", + hello: &tls.ClientHelloInfo{ + SupportedVersions: []uint16{tls.VersionTLS13, 0x1A1A /* GREASE */, tls.VersionTLS12, 0x2A2A /* GREASE */}, + SupportedProtos: []string{"http/1.1"}, + }, + expected: "t13i0000h1_000000000000_000000000000", + }, } for _, tt := range tests {