Skip to content
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 for ua-reduction, do not provide 'detailed' info from 'reduction' strings #537

Open
mbeijen opened this issue Feb 9, 2023 · 0 comments

Comments

@mbeijen
Copy link

mbeijen commented Feb 9, 2023

Since last year, the major browsers started to 'freeze' their user-agent strings to prevent too much 'profiling'. This applies to Chrome, Firefox, Edge and Safari and possibly other browsers as well.

See this article on the Chromium website:
https://www.chromium.org/updates/ua-reduction/#token-reference

the 'platform' in the string is frozen. for my mac, which runs macOS 12.6.3

Chrome:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36

Firefox:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/109.0

Safari:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15

Here, my OS is detected as:

 {
    "family": "Mac OS X",
    "major": "10",
    "minor": "15",
    "patch": null, // (or 7 in Chrome or Safari)
    "patch_minor": null
}

On Windows, it's the same thing, only the string is frozen to Windows NT 10.0; Win64; x64 always, even if you use Windows 11. This is actually how I noticed it. I use Sentry and all my Sentry reports from Windows users reported their platform as Windows 10, which I knew was not right, the majority arej Windows 11 users. Sentry uses python ua_parser and thus this library.

Because of the 'user agent redux' we can not tell if a user is using macOS Catalina, or Big Sur, or Monterey, we can not tell if they are using Windows 10 or 11. And currently we try to tell the user is on macOS 10.15 or Windows 10, which is misleading!

The solution would be, to not provide these details if we can't be sure. So in my case, it should just respond with "family": "Mac OS X" (or rather macOS) and the rest set to null;

 {
    "family": "Mac OS X",
    "major": null,
    "minor": null,
    "patch": null,
    "patch_minor": null
},

Please note that all major 'modern' browsers have this behaviour now

ua-parser can try to match the 'exact' frozen strings, so for UA strings from older browsers, the correct version is still reported, or it can just opt to no longer supply this information. I can create a PR for this if desired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant