vladimiry / ElectronMail

Unofficial ProtonMail Desktop App
GNU General Public License v3.0
1.5k stars 97 forks source link

Captcha error with v4.12.8 #443

Closed mike2307 closed 2 years ago

mike2307 commented 2 years ago

After updating to the latest flatpak version of electronmail (v4.12.8), the captcha after the login isn't working any more.

Instead of showing the captcha, a new login prompt is being shown. When entering the credentials there again and hitting enter, no action seems to be happening.

See the following screenshot: Screenshot from 2021-09-26 22-27-49

Help would be appreciated. Thanks in advance.

vladimiry commented 2 years ago
mike2307 commented 2 years ago

API entry point is "https://mail.protonmail.com (proton-mail@4.8.0)".

And yes. A downgrade to v4.12.7 helps. I did it with: sudo flatpak update --commit=d699406742de58e061aecdb6539cb4fcb8514c13bb34b84a22536801213898f7 com.github.vladimiry.ElectronMail

vladimiry commented 2 years ago

At the moment @protonmail only supports captcha endpoint for the https://mail.protonmail.com/ "API entry point" value, see #419 for details.

According to https://github.com/ProtonMail/react-components/blob/d974f1f4026571e6d4be074f689c5f997f2b700a/containers/api/humanVerification/Captcha.tsx#L5-L11 they were resolving captcha iframe url for the https://mail.protonmail.com/ "API entry point" value as https://mail-api.protonmail.com/core/v4/captcha. But it looks like they recently changed the resolving logic and it now gets resolved as the webclient0://mail-api.protonmail.com/core/v4/captcha-like value. So the captcha iframe address was API_URL-based, but now it's location.origin-based. There is clearly no webclient0://mail-api.protonmail.com/core/v4/captcha static page packed into the app and so the app does redirect to the entry/index/login page in this/404-error case - this is why you get the login form displayed in the captcha modal.

So it appears that I missed noticing the above-described change doing @ProtonMail web clients stack updating in 2299d9a76acc818112b98e9f9414536773e5e315. It looks like the @ProtonMail client needs to be patched in the way we get previous captcha resolving behavior, so we get https scheme instead of the currently wrongly resolved webclient0-like scheme. The bad thing is that it's not so easy to trigger the captcha modal to be displayed at my side for the fix testing purposes, but there should be a way or I could ask you @mike2307 to test the fixed/wip-v4.12.9 version when it's ready.

mike2307 commented 2 years ago

@vladimiry Yes, sure. I can do some testing as soon a flatpak testing version is available. :+1:

vladimiry commented 2 years ago

flatpak testing version is available

Technically possible but would be a more time-consuming option for me. Any chance you could build deb/pacman/other package from sources or at least use the deb/pacman/other package compiled at CI system?

mike2307 commented 2 years ago

I only have access to fedora based systems. So I would need a flatpak, rpm or the AppImage in worst case. Otherwise someone else with a debian/ubuntu system should volunteer for testing...

vladimiry commented 2 years ago

Ok, the rpm & appImage should be available first and then maybe flatpak on "beta" branch too but a little later.

vladimiry commented 2 years ago

I've briefly tested the WIP fix and the captcha worked well for the https://mail.protonmail.com/ API endpoint. The fix simply sets the https scheme to result URL by url.protocol = "https:" assigning. So now triggering the WIP packages building on CI system.

vladimiry commented 2 years ago

The rpm package and instruction how to install & run flatpak beta build is shared here https://github.com/vladimiry-playground/electron-mail-issue-443 for testing. The flatpak beta has not yet been update in the remote repository (I guess it will take some time).

vladimiry commented 2 years ago

The flatpak beta has not yet been update in the remote repository (I guess it will take some time).

The possible workaround (while it's not yet listed in flatpak search com.github.vladimiry.ElectronMail):

vladimiry commented 2 years ago

The rpm package ...

If needed, the remaining Linux packages shared here. The related hashes listed in https://github.com/vladimiry-playground/electron-mail-issue-443.

vladimiry commented 2 years ago

I've briefly tested the WIP fix and the captcha worked well for the https://mail.protonmail.com/ API endpoint.

Repeated the test using the release candidate build assembled from the master branch and the captcha got displayed. So I'm ok releasing new version.

vladimiry commented 2 years ago

By the way @mike2307, consider trying the persistent sessions feature so you don't face the login forms anymore. In this case, the issue would remain unnoticed for a longer period though. Ideally, I would enable the e2e test scenario for the captcha case but I'm not ready to jump into dealing with this stuff yet (for testing purposes, there needs to be a way to trigger the captcha scenario in 100% of cases which I'm not aware of not being a proton team member).

mike2307 commented 2 years ago

@vladimiry Wow, this has literally been fixed over night. :+1: I just tried the flatpak version from the flathub beta channel and it works perfectly fine again.

mike2307 commented 2 years ago

@vladimiry Just one note: This should be soon be moved to the stable channel because users will get updated eventually to the broken v4.12.8 version otherwise.

vladimiry commented 2 years ago

I just tried the flatpak version from the flathub beta channel and it works perfectly fine again.

Except for that it/beta-build has cut out spellcheck dictionaries (it was easier for me to make the beta build this way, see the commit). PS Just got the "beta" channel synced with stable/master now.

This should be soon be moved to the stable channel because users will get updated eventually to the broken v4.12.8 version otherwise.

Sure, the "stable" update has already been committed https://github.com/flathub/com.github.vladimiry.ElectronMail/commit/c16b12430f395f6fe3a7f1ceff9af2b9e5e3506f. After the commit happened, it normally takes some time for the update to be available for users (I guess something like 6-12 hours). I guess the "flathub" might offer a way to speed up update propagating but I'm not aware of it. Use the flatpak update --appstream && flatpak search com.github.vladimiry.ElectronMail to see if it's already available or just refresh the https://flathub.org/apps/details/com.github.vladimiry.ElectronMail page.

vladimiry commented 2 years ago

After the commit happened, it normally takes some time for the update to be available for users (I guess something like 6-12 hours). I guess the "flathub" might offer a way to speed up update propagating but I'm not aware of it.

https://github.com/flathub/flathub/wiki/App-Maintenance#automatic-publishing-delay

The default is to publish successfully built (non-test) builds after 3 hours.

but could be changed in https://github.com/flathub/com.github.vladimiry.ElectronMail/blob/master/flathub.json via the publish-delay-hours value.