-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support to access raw HTTP headers #1307
base: master
Are you sure you want to change the base?
Conversation
Not terribly fond of special features to help track users especially when they're not compatible with HTTP/2. But let's leave it open for now and see if it could benefit other use cases. |
Though everything can be used for Evil(tm), my personal use is when the User-Agent claims to be Windows/Chrome but is actually Linux/PhantomJS. The idea is that combined with other signals then if, for example, they are lying about the User-Agent and the IP is from a data center then they probably are up to no good and should be blocked. Thanks for the feedback. |
FYI, raw headers (capturing the header ordering and case-sensitively of the name) provide no benefit for tracking users. There is a This gleans you no more information about the user that you could obtain just from parsing the value of the User-Agent its-self which is more unique (I see user id's in there...the internet is awful...). |
Sure but that doesn't change things much, field order has no meaning in the protocol (except for fields of the same name) and you risk burning yourself if/when legitimate clients end up doing the same. In Cowboy I would prefer to stick as close as possible to the protocols. Still, maybe someone has a need for this for other reasons so let's wait a few months and see if it can be useful. |
5a5b787
to
c32d2d7
Compare
You're not alone wanting this golang/go#24375 Also https://www.sans.org/reading-room/whitepapers/detection/paper/34460 I like the principle behind the implementation of the PR though. So if there's more demand I'm not against including. |
I'm looking into doing the HTTP/2 version as I need it for my use case too.
I'll submit those changes once I have them.
Thanks
…On 31 October 2018 16:21:46 Loïc Hoguin ***@***.***> wrote:
You're not alone wanting this golang/go#24375
Also https://www.sans.org/reading-room/whitepapers/detection/paper/34460
I like the principle behind the implementation of the PR though. So if
there's more demand I'm not against including.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Hmm are you going to keep raw data also, perhaps just the HEADERS block? Just curious. |
Depends on how much I need. For HTTP 1.x I only need the header order and
not the values, no idea what I need to do for HTTP/2 fingerprinting, but I
am currently busy with SSL fingerprinting.
…On 31 October 2018 16:57:18 Loïc Hoguin ***@***.***> wrote:
Hmm are you going to keep raw data also, perhaps just the HEADERS block?
Just curious.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
At IETF103 it was mentioned it could become a requirement for intermediaries to send headers without concatenating them, so it's possible a more general solution will be required in the future. If that happens I'll favor a mode to select whether Cowboy should operate using maps or lists of headers, with the caveat of course that lists will be slower to manipulate. |
d2d8ad9
to
04ac41e
Compare
8995c89
to
235cf3e
Compare
e1b1fdd
to
bc5d952
Compare
Attached is a the HTTP/2 supporting updated implementation that I use in my passive browser fingerprinting library. Thoughts? I'll write some unit tests if this looks to be an acceptable approach. |
Hm I would rather have a more consistent approach, from what I understand HTTP/1.1 gives a binary while HTTP/2 gives the parsed list of headers. Is there any reason for HTTP/1.1 to be a binary? |
For my use case, no as in my project I actually convert the binary to an KV list anyway. :) As this is 'raw' I thought for the generic case (as those users have particular needs and processing ideas) it was maybe best to expose what ever was closest to the wire representation for full headers (otherwise maybe I should just return the frame?). Mostly as some may for HTTP/1.1 decide they want to use a binary match to search for leading white space in values without having to iterate over a list. Happy to add something to the HTTP/1.x side to fix up the returned value into something more resembling |
bc5d952
to
2cc509e
Compare
2cc509e
to
430e758
Compare
430e758
to
a867cda
Compare
I have a requirement to inspect the ordering and case-sensitive-ness of the HTTP headers in the request for User-Agent identification. As cowboy only supports normalised header access, I wired in a
headers_raw
boolean option to make the request object containheaders_raw
:My use case is then to then access this via middleware to do browser identification.
Before making this PR 'worthy', at this point I really looking for feedback on your appetite for this sort of thing, and if this is the best way to plumb it in and maybe you have some suggestions and/or recommendations?