-
Notifications
You must be signed in to change notification settings - Fork 851
ja*: Fix preserve logic to check for any header in fingerprint group #12811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| +++++++++ Proxy's Request after hooks +++++++++ | ||
| -- State Machine Id`` | ||
| POST /some/path/http2`` | ||
| `` | ||
| x-ja3-raw: first-signature`` | ||
| x-ja3-via: first-via`` | ||
| `` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,4 +3,5 @@ | |
| POST /some/path/http2`` | ||
| `` | ||
| x-ja3-sig: `` | ||
| x-ja3-via: `` | ||
| `` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,8 @@ meta: | |
| version: "1.0" | ||
|
|
||
| sessions: | ||
|
|
||
| # Session 1: No pre-existing JA4 headers - new headers should be added. | ||
| - protocol: | ||
| - name: http | ||
| version: 1 | ||
|
|
@@ -33,11 +35,12 @@ sessions: | |
| fields: | ||
| - [ Connection, keep-alive ] | ||
| - [ Content-Length, 0 ] | ||
| - [ uuid, no-existing-headers ] | ||
|
|
||
|
Comment on lines
+38
to
39
|
||
| proxy-request: | ||
| headers: | ||
| fields: | ||
| - [ ja4, { as: contains } ] | ||
| - [ ja4, { as: present } ] | ||
| - [ x-ja4-via, { value: 'test.proxy.com', as: equal } ] | ||
|
|
||
| server-response: | ||
|
|
@@ -46,3 +49,70 @@ sessions: | |
| content: | ||
| encoding: plain | ||
| data: Yay! | ||
|
|
||
| # Session 2: Pre-existing JA4 headers - with preserve, no new headers added. | ||
| - protocol: | ||
| - name: http | ||
| version: 1 | ||
| - name: tcp | ||
| - name: ip | ||
|
|
||
| transactions: | ||
| - client-request: | ||
| method: "GET" | ||
| version: "1.1" | ||
| url: /resource-with-headers | ||
| headers: | ||
| fields: | ||
| - [ Connection, keep-alive ] | ||
| - [ Content-Length, 0 ] | ||
| - [ uuid, existing-ja4-headers ] | ||
| - [ ja4, upstream-fingerprint ] | ||
| - [ x-ja4-via, upstream.proxy.com ] | ||
|
|
||
| # With --preserve and existing JA4 headers, no new headers should be added. | ||
| proxy-request: | ||
| headers: | ||
| fields: | ||
| - [ ja4, { value: 'upstream-fingerprint', as: equal } ] | ||
| - [ x-ja4-via, { value: 'upstream.proxy.com', as: equal } ] | ||
|
|
||
| server-response: | ||
| status: 200 | ||
| reason: OK | ||
| content: | ||
| encoding: plain | ||
| data: Preserved! | ||
|
|
||
| # Session 3: Only x-ja4-via exists - should still trigger preserve for all. | ||
| - protocol: | ||
| - name: http | ||
| version: 1 | ||
| - name: tcp | ||
| - name: ip | ||
|
|
||
| transactions: | ||
| - client-request: | ||
| method: "GET" | ||
| version: "1.1" | ||
| url: /resource-via-only | ||
| headers: | ||
| fields: | ||
| - [ Connection, keep-alive ] | ||
| - [ Content-Length, 0 ] | ||
| - [ uuid, existing-via-only ] | ||
| - [ x-ja4-via, upstream.proxy.com ] | ||
|
|
||
| # With --preserve and only x-ja4-via present, no JA4 headers should be added. | ||
| proxy-request: | ||
| headers: | ||
| fields: | ||
| - [ ja4, { as: absent } ] | ||
| - [ x-ja4-via, { value: 'upstream.proxy.com', as: equal } ] | ||
|
|
||
| server-response: | ||
| status: 200 | ||
| reason: OK | ||
| content: | ||
| encoding: plain | ||
| data: Via only! | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make more sense to say TS_ERROR == ? I think it might be easier to read the code that way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I see your perspective. I think I'll stick with this though for the sake of consistency since that's what the other checks for error do in this plugin.