IsmaelMartinez / teams-for-linux

Unofficial Microsoft Teams for Linux client
GNU General Public License v3.0
2.95k stars 240 forks source link

Implement emulateWinChromiumPlatform Flag for OS Emulation #1395

Closed 3wweiweiwu closed 2 months ago

3wweiweiwu commented 2 months ago

Challenge

Some organizations use a Multi-Factor Authentication (MFA) application that supports only Windows and Mac systems. Users with unsupported operating systems, like Linux, are denied access due to system checks.

Problem Analysis

Web-based MFA applications often use properties such as navigator.userAgent, navigator.userAgentData.platform, navigator.platform, and navigator.userAgentData.getHighEntropyValues to detect the user's operating system. Although there is an option to modify the user agent, other properties also need emulation to fully mimic a Windows environment.

Technical Details

The implementation introduce a new PlatformEmulator class. It will be executed as part of preload script for chromium. This class will override specified property to emulate windows platform.

Solution

Add the emulateWinChromiumPlatform flag to the CLI and configuration file, allowing users to opt-in to Windows platform emulation in Chromium browsers. This flag is turned off by default to avoid interference with existing workflows.

Documentation

Updated the README and the configuration documentation to include instructions on how to use the new emulateWinChromiumPlatform flag.

Potential Impacts

This change should not impact existing users as the default behavior remains unchanged. The feature is opt-in to ensure that only users needing this emulation enable it.

IsmaelMartinez commented 2 months ago

HI @3wweiweiwu , thanks a lot for contributing! I am hoping to release 1st the other PR (https://github.com/IsmaelMartinez/teams-for-linux/pull/1393). Then, if you could update the package.json file and the appdata (as described in https://github.com/IsmaelMartinez/teams-for-linux/blob/develop/CONTRIBUTING.md#release-process) I can then merge it. But I will wait until the other PR is merged (so this would be released as 1.10.2). Thanks again!

IsmaelMartinez commented 2 months ago

1.10.1 is now out. If you can rebase and make the changes mentioned in my previous comment, then I can release this. (your version should be 1.10.2). Thanks!

3wweiweiwu commented 2 months ago

1.10.1 is now out. If you can rebase and make the changes mentioned in my previous comment, then I can release this. (your version should be 1.10.2). Thanks!

I just re-based the PR, can you help to check?

IsmaelMartinez commented 2 months ago

looks good to me.

Can you update the package.json file and the appdata (as described in https://github.com/IsmaelMartinez/teams-for-linux/blob/develop/CONTRIBUTING.md#release-process). I can't make the changes on your branch.

Then we can release it. Thanks again for your contribution!

3wweiweiwu commented 2 months ago

looks good to me.

Can you update the package.json file and the appdata (as described in https://github.com/IsmaelMartinez/teams-for-linux/blob/develop/CONTRIBUTING.md#release-process). I can't make the changes on your branch.

Then we can release it. Thanks again for your contribution!

Updated package.json and app.xml. Thank you for your continuous support and guidance!

sonarcloud[bot] commented 2 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

IsmaelMartinez commented 2 months ago

That is merged! It will be out at some point today (hopefully soon). As it is behind a flag/config option, this will go directly to a release.

Are you able to put a we example configuration on how this will work? That way other users that have been having problems with MFA can take advantage of it. Just a few comments in here will do (I can put it in a readme file later on once is tested by many)

Thanks again for contributing!

IsmaelMartinez commented 2 months ago

released! https://github.com/IsmaelMartinez/teams-for-linux/releases/tag/v1.10.2

FranzXaver commented 2 months ago

Thanks for this feature, this is exactly what I needed as my company also blocks Linux from MFA. I had to also set the chromeUserAgent for it to work though, is this as exepected?

3wweiweiwu commented 2 months ago

Thanks for this feature, this is exactly what I needed as my company also blocks Linux from MFA. I had to also set the chromeUserAgent for it to work though, is this as exepected?

Yes, that is expected. You need to set both. Make sure your chromeUserAgent string is up-to-date as some MFA check chrome version as well.