feat: also filter grease in SupportedProtos #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request fixes the
JA4fingerprinting implementation by also filtering out GREASE values inSupportedProtos. It also does a minor optimization of extension hashing by skipping one unnecessary copy.Improvements to GREASE filtering and extension handling:
ja4plus.go: Updated theJA4function to filter GREASE values when determining the first ALPN and to usefilteredExtensionsin the extension hash computation. This ensures GREASE values are excluded from both the ALPN and extension hash logic. [1] [2]ja4plus.go: Modified theextensionHashfunction to explicitly require filtered extensions and clarified its documentation. The function now sorts extensions in-place and excludes GREASE values, SNI, and ALPN from the hash computation.Test coverage enhancements:
ja4plus_test.go: Added new test cases inTestJA4to verify behavior with all-GREASE inputs and ensure the function handles invalid protocol versions defensively without panicking.ja4plus_test.go: Removed redundant test cases for GREASE-only extensions inTestExtensionHashsince GREASE filtering is now integrated into the core logic.Minor updates:
ja4plus.go: Added theencoding/binaryimport to support GREASE filtering logic.