nielsbasjes / yauaa

Yet Another UserAgent Analyzer
https://yauaa.basjes.nl
Apache License 2.0
761 stars 129 forks source link

Edge 106 with UACH detected as Chrome 106 #786

Closed willyaranda closed 1 year ago

willyaranda commented 1 year ago

Please read this to ensure this is really a bug: https://yauaa.basjes.nl/developer/reportingissues/#these-are-not-bugs

The exact useragent useragent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36'

With the following UserAgentClient hints provided and printed by the parsed object of yauaa:

Sec-Ch-Ua                            : '"Chromium";v="106", "Microsoft Edge";v="106", "Not;A=Brand";v="99"'
      Sec-Ch-Ua-Arch                       : 'x86'
      Sec-Ch-Ua-Mobile                     : '?0'
      Sec-Ch-Ua-Model                      : ''
      Sec-Ch-Ua-Platform                   : 'Windows'
      Sec-Ch-Ua-Platform-Version           : '14.0.0'

Expected/Incorrect fields AgentNameVersion: Microsoft Edge 106 (and others that identify this as Chrome and not Edge) ...

Expected behavior I expect this to be detected as Edge 106, and not Chrome, as the Sec-Ch-Ua sends correctly.

Additional information If you know of specifications provided by the builder of the agent or system at hand then please provide these specifications.

willyaranda commented 1 year ago

My bad. I was not scaping properly the Sec-CH-Ua fields with the leading and trailing " chars

willyaranda commented 1 year ago

Sorry to reopen @nielsbasjes , but I think I got it right in the first time I opened the bug šŸ¤¦

The UA I'm having issues is when there is no information about Edge, like:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36

Even if the UACH are correctly set like:

Sec-Ch-Ua                            : '"Chromium";v="106", "Microsoft Edge";v="106", "Not;A=Brand";v="99"'
      Sec-Ch-Ua-Arch                       : '<<<null>>>'
      Sec-Ch-Ua-Mobile                     : '?0'
      Sec-Ch-Ua-Model                      : '<<<null>>>'
      Sec-Ch-Ua-Platform                   : '"Windows"'
      Sec-Ch-Ua-Platform-Version           : '<<<null>>>'

And the parsed output from the library is

UAClientHintBrands_0_Brand           : 'Chromium'
UAClientHintBrands_0_Version         : '106'
UAClientHintBrands_1_Brand           : 'Microsoft Edge'
UAClientHintBrands_1_Version         : '106'

I'm checking against other Legacy UA, like:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.34

Which are correctly detected as Edge.

nielsbasjes commented 1 year ago

I've checked my Window 11 with Edge 106 and the user agent in my case is what you call the legacy UA:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.52

So how did you find the user agent you presented (i.e. without the 'Edg/...' part)?

nielsbasjes commented 1 year ago

The full set of my Edge (yaml syntax):

  User-Agent                                 : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.52'
  Sec-Ch-Ua                                  : '"Chromium";v="106", "Microsoft Edge";v="106", "Not;A=Brand";v="99"'
  Sec-Ch-Ua-Arch                             : '"x86"'
  Sec-Ch-Ua-Bitness                          : '"64"'
  Sec-Ch-Ua-Full-Version                     : '"106.0.1370.52"'
  Sec-Ch-Ua-Full-Version-List                : '"Chromium";v="106.0.5249.119", "Microsoft Edge";v="106.0.1370.52", "Not;A=Brand";v="99.0.0.0"'
  Sec-Ch-Ua-Mobile                           : '?0'
  Sec-Ch-Ua-Model                            : '""'
  Sec-Ch-Ua-Platform                         : '"Windows"'
  Sec-Ch-Ua-Platform-Version                 : '"15.0.0"'
  Sec-Ch-Ua-Wow64                            : '?0'
willyaranda commented 1 year ago

@nielsbasjes this is a RAW dump of the headers of ClientEvent / ClientQos from the customers hitting our stats API.

nielsbasjes commented 1 year ago

I try to base detections on specs where possible/available. For Edge: https://learn.microsoft.com/en-us/microsoft-edge/web-platform/user-agent-guidance#identifiers-for-microsoft-edge-on-various-platforms

On desktop operating systems, Microsoft Edge is commonly identified by the Edg token in the User-Agent string.

So the Edg/EdgA/EdgiOS should always be there for it to be a real Edge.

Are you being hit by fakers of some sort?

willyaranda commented 1 year ago

Not that we are aware of. Checking some of those customers seems legit and using our platform properly.

Other User Agent is version 105:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36

I will dig more in case this is something strange

nielsbasjes commented 1 year ago

Fixed. https://github.com/nielsbasjes/yauaa/blob/main/analyzer/src/main/resources/UserAgents/ClientHints-Tests.yaml#L1518

nielsbasjes commented 1 year ago

I have just released version 7.8.0 which contains this fix.