ja*: Fix preserve logic to check for any header in fingerprint group#12811
Merged
bneradt merged 1 commit intoapache:masterfrom Jan 29, 2026
Merged
Conversation
49e7f6f to
a7a1dd3
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the JA3 and JA4 fingerprint plugins’ --preserve behavior to operate at the “fingerprint group” level (skip adding all related headers if any already exist), preventing mixed upstream/downstream fingerprint header sets.
Changes:
- JA3 plugin: add group-level “any JA3 header exists” check before adding JA3 headers.
- JA4 plugin: add
--preserveoption plus group-level “any JA4 header exists” check before adding JA4 headers. - Tests/gold files updated to validate group-level preserve behavior for both plugins.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/ja3_fingerprint/ja3_fingerprint.cc | Implements group-level preserve logic for JA3 header set. |
| plugins/experimental/ja4_fingerprint/plugin.cc | Adds --preserve option parsing and group-level preserve logic for JA4 headers. |
| tests/gold_tests/pluginTest/ja4_fingerprint/ja4_fingerprint.test.py | Adds test coverage for JA4 --preserve behavior. |
| tests/gold_tests/pluginTest/ja4_fingerprint/ja4_fingerprint.replay.yaml | Extends replay scenarios to validate JA4 preserve cases. |
| tests/gold_tests/pluginTest/ja3_fingerprint/ja3_fingerprint.test.py | Adjusts JA3 test assertions for group-level preserve behavior. |
| tests/gold_tests/pluginTest/ja3_fingerprint/ja3_fingerprint_global.replay.yaml | Updates expected JA3 header presence/absence under preserve. |
| tests/gold_tests/pluginTest/ja3_fingerprint/modify-incoming-proxy.gold | Updates expected internal proxy header output for modify-incoming + preserve. |
| tests/gold_tests/pluginTest/ja3_fingerprint/modify-sent-proxy-remap.gold | Updates expected internal proxy header output for remap configuration. |
| tests/gold_tests/pluginTest/ja3_fingerprint/modify-sent-proxy-global.gold | New gold file for global-plugin internal proxy header output expectations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/gold_tests/pluginTest/ja3_fingerprint/ja3_fingerprint.test.py
Outdated
Show resolved
Hide resolved
tests/gold_tests/pluginTest/ja4_fingerprint/ja4_fingerprint.test.py
Outdated
Show resolved
Hide resolved
jasmine-nahrain
previously approved these changes
Jan 27, 2026
Problem: When --preserve was enabled and a request passed through multiple proxies, each header was checked individually. This could result in mismatched fingerprint data - for example, x-ja3-raw being added by a downstream proxy while x-ja3-sig was preserved from an upstream proxy. Solution: The JA3 and JA4 fingerprint plugins now check if ANY header in a fingerprint group exists before adding headers. If any header in the group exists, ALL headers in that group are skipped. Changes: - ja3_fingerprint: Added group-level checks for JA3 headers - ja4_fingerprint: Added --preserve option and group-level check for JA4 headers - Updated tests to verify group-level preserve behavior
a7a1dd3 to
0e83273
Compare
jasmine-nahrain
approved these changes
Jan 28, 2026
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.
Problem:
When --preserve was enabled and a request passed through multiple proxies, each header was checked individually. This could result in mismatched fingerprint data - for example, x-ja3-raw being added by a downstream proxy while x-ja3-sig was preserved from an upstream proxy.
Solution:
The JA3 and JA4 fingerprint plugins now check if ANY header in a fingerprint group exists before adding headers. If any header in the group exists, ALL headers in that group are skipped.
Changes: