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

Fix invalid browser name, version and plugins messages (#3051) #3149

Merged
merged 8 commits into from
Oct 25, 2024

Conversation

zinduolis
Copy link
Collaborator

@zinduolis zinduolis commented Sep 24, 2024

Pull Request

Thanks for submitting a PR! Please fill in this template where appropriate:

Category

Bug

Feature/Issue Description

Q: Please give a brief summary of your feature/fix
A: Fix invalid browser version and plugins messages (#3051)

Q: Give a technical rundown of what you have changed (if applicable)
A: Updated conditions checking for valid browser version. Also added message for situation when plugins are not detected (e. g. for mobile browsers). Added https://github.com/bowser-js/bowser and extended Chrome, Firefox and Opera browser name recognition.

Test Cases

Q: Describe your test cases, what you have covered and if there are any use cases that still need addressing.
A: Successfully ran bundle exec rake, had print_info in the browser.rb file to confirm the values when hooking Firefox, Chrome, Opera and Android Chrome. Also, executed all the debug modules with these 3 browser types without any errors on beef side.

Wiki Page

If you are adding a new feature that is not easily understood without context, please draft a section to be added to the Wiki below.

@bcoles
Copy link
Collaborator

bcoles commented Sep 24, 2024

window.navigator.userAgent cannot be trusted. This is why we perform checks for each browser version using browser fingerprinting.

Although the current implementation is insane (it was developed when there was usually years between major releases), we should not throw it out in favor of weak detection (ie, untrusted user agent string).

The entire browser fingerprinting system needs to be reworked.

If your goal is to make the "invalid browser" error message go away, please extend the existing functionality.

@bcoles
Copy link
Collaborator

bcoles commented Sep 24, 2024

If you would prefer to rework the browser fingerprinting, please see:

@zinduolis
Copy link
Collaborator Author

Thanks, @bcoles, for your feedback, I have extended the existing functionality.

In scope of #3051, I would like to address the invalid name / version and plugins issues.

I've noticed that the browser fingerprinting functionality could benefit from significant refactoring. I'd be happy to take on this task once I complete the current fix, given its priority and my availability.

@zinduolis zinduolis changed the title Fix invalid browser name issue for Firefox, Chrome and Opera (#3051) Fix invalid browser name, version issues for Firefox, Chrome and Opera (#3051) Sep 27, 2024
@zinduolis zinduolis changed the title Fix invalid browser name, version issues for Firefox, Chrome and Opera (#3051) Fix invalid browser name, version and plugins messages (#3051) Sep 29, 2024
@zinduolis
Copy link
Collaborator Author

Hey @bcoles , @stephenakq , I believe I've resolved the issue. Can we merge this one?

Copy link
Collaborator

@bcoles bcoles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user agent cannot be trusted. Please extend the existing approach to support new browser versions.

core/filters/browser.rb Outdated Show resolved Hide resolved
@zinduolis
Copy link
Collaborator Author

Hi @bcoles , am I still missing anything or this can finally be merged? Thanks

@bcoles
Copy link
Collaborator

bcoles commented Oct 2, 2024

Hi @bcoles , am I still missing anything or this can finally be merged? Thanks

The user agent cannot be trusted to identify the browser.

The entire browser detection needs to be reworked (#1392). In lieu of resolving the underlying issue, the browser detection should continue to use the existing approach.

@zinduolis zinduolis had a problem deploying to Integrate Pull Request October 4, 2024 06:22 — with GitHub Actions Failure
@zinduolis
Copy link
Collaborator Author

@bcoles , I have reverted the UA check to find browser name. Any issues with the fixes for version and plugin checks?

@zinduolis zinduolis changed the title Fix invalid browser name, version and plugins messages (#3051) Fix invalid browser version and plugins messages (#3051) Oct 4, 2024
@zinduolis zinduolis had a problem deploying to Integrate Pull Request October 7, 2024 05:20 — with GitHub Actions Failure
@zinduolis
Copy link
Collaborator Author

Hey @stephenakq , as requested I have added https://github.com/bowser-js/bowser into the code and extended the browser name recognition functionality for Chrome, Firefox and Opera. This PR now has everything that's needed to address #3051

Could you please merge this PR now? Thanks

@zinduolis zinduolis changed the title Fix invalid browser version and plugins messages (#3051) Fix invalid browser name, version and plugins messages (#3051) Oct 18, 2024
@stephenakq stephenakq merged commit d88439d into beefproject:master Oct 25, 2024
4 of 5 checks passed
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

Successfully merging this pull request may close these issues.

4 participants