feat: also filter grease in SupportedProtos#6
Merged
Conversation
c8a8791 to
ddffbea
Compare
ddffbea to
0a0b757
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the JA4 fingerprinting algorithm to filter out GREASE values from SupportedProtos when determining the first ALPN value, improving consistency with how GREASE values are handled in other parts of the codebase.
- Adds GREASE filtering logic for protocol selection in the JA4 function
- Updates extension hash computation to use pre-filtered extensions and avoid redundant GREASE filtering
- Adds comprehensive test coverage for GREASE handling scenarios and edge cases
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ja4plus.go | Implements GREASE filtering for SupportedProtos and optimizes extensionHash function |
| ja4plus_test.go | Adds test cases for GREASE filtering and invalid protocol handling |
0a0b757 to
3939be0
Compare
wind0r
approved these changes
Jul 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.