From 2fdef3fe713119a42d5e3fd6ad97298b611b42e4 Mon Sep 17 00:00:00 2001 From: Danny-Dasilva Date: Tue, 28 Apr 2026 11:47:34 -0400 Subject: [PATCH] feat(extensions): expose proper utls types for ID 17, 17613, 30032 Audit of utls 1.8.x parrot map (genMap) revealed three pre-existing gaps where dedicated utls extension types existed but genMap fell back to GenericExtension. Replacing them with the proper types lets utls own the wire encoding (including any future bugfixes) and removes hand-rolled byte payloads: - ID 17 (status_request_v2): GenericExtension -> StatusRequestV2Extension (proper RFC 6961 encoding instead of zero-length GenericExtension) - ID 17613 (TLS ALPS new codepoint): GenericExtension -> ApplicationSettingsExtensionNew Hand-rolled 5-byte payload {0x00,0x03,0x02,0x68,0x32} replaced by SupportedProtocols-driven encoding identical to ID 17513. - ID 30032 (Channel ID): GenericExtension(Id:0x7550, Data:{0}) -> FakeChannelIDExtension{}. Wire format also corrected: real Chrome ChannelID is a 4-byte zero-payload extension, the previous GenericExtension emitted 5 bytes (length=1). ID 51 (KeyShare), ID 43 (SupportedVersions), IDs 10/11 (curves/points) remain populated by callers because they depend on per-call inputs (version, GREASE flag, JA3 curves). ID 65037 (GREASE_ECH) is already correctly using utls.BoringGREASEECH(). IDs 22 (encrypt_then_mac) and 49 (post_handshake_auth) intentionally stay as GenericExtension because utls does not provide dedicated types for them. go build ./... and go test ./... -short pass. --- golang/utils.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/golang/utils.go b/golang/utils.go index 858295b..8d50bb9 100644 --- a/golang/utils.go +++ b/golang/utils.go @@ -933,7 +933,7 @@ func genMap(disableGrease bool) (extMap map[string]utls.TLSExtension) { "16": &utls.ALPNExtension{ AlpnProtocols: []string{"h2", "http/1.1"}, }, - "17": &utls.GenericExtension{Id: 17}, // status_request_v2 + "17": &utls.StatusRequestV2Extension{}, // status_request_v2 (17) "18": &utls.SCTExtension{}, "21": &utls.UtlsPaddingExtension{GetPaddingLen: utls.BoringPaddingStyle}, "22": &utls.GenericExtension{Id: 22}, // encrypt_then_mac @@ -999,11 +999,12 @@ func genMap(disableGrease bool) (extMap map[string]utls.TLSExtension) { "h2", }, }, - "17613": &utls.GenericExtension{ - Id: 17613, - Data: []byte{0x00, 0x03, 0x02, 0x68, 0x32}, + "17613": &utls.ApplicationSettingsExtensionNew{ + SupportedProtocols: []string{ + "h2", + }, }, - "30032": &utls.GenericExtension{Id: 0x7550, Data: []byte{0}}, // Channel ID extension + "30032": &utls.FakeChannelIDExtension{}, // Channel ID extension (30032 / 0x7550, new ID) "65281": &utls.RenegotiationInfoExtension{ Renegotiation: utls.RenegotiateOnceAsClient, },