-
-
Notifications
You must be signed in to change notification settings - Fork 128
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
.cryptkey Error During Non-SSO Account Switching after SSO Login or vice-versa #1746
Comments
@the-djmaze Please check this one as cryptkey is not working when we switch between sso to non sso or vice-versa |
This is correct because in OAUTH the password (access token) constantly changes. That's why the GMail extension sets something different as "password". snappymail/plugins/login-gmail/index.php Line 125 in 0db6c6a
It uses the Gmail userinfo You must use a similar approach to get the cryptkey stable |
@the-djmaze Your fix is not working. It still have the same error. |
Ok, but the PR can't be in the core. A better aproach must be made in the extension and Nextcloud code then. |
@the-djmaze Yes you are right. But we do have some limitation thats why i gone this way: Even if i do crypt code inside SnappyMailHelper.php
Still problem is this: When i have two login option one is with SSO and one is without SSO if CryptKey function gets call from both then So that is why i modified the code here and i also if you see ELSE section is same. In case of two login (this is oidc_login ) option is enabled this IF section get executed. I understand we are using it with rainloop core files but in extreme cases this is the possible option. If you have any suggestion , how can i approach this other then this way then let me know. |
@the-djmaze Is there any suggestion from your end how we can allow both login one with sso and one with non sso to have .crypt key same. Bcoz if i try to setPassword to same in both cases either one autologin stops working. Even currently with your fix autologin for sso is not working in 2.38.0 |
I want to get something cleared up:
So you use 2 login methods for the same email address. Correct? |
@the-djmaze Yes, its correct. I have two way to login with same email |
Then it is not possible. A better approach would be a system option Using SSO and normal login also pretty defeats the security of SSO. |
Actually, no. For me the problem is:
|
@the-djmaze @avinash-0007 Would it make sense to decrypt and encrypt again with new access token whenever the access token is updated with a Nextcloud event listener? As we do have an Would it even be do-able as this would be code in the nextcloud integration app and no longer in a snappymail plugin. And at account addition, we encrypt additional account key with the current access token in the plugin. |
Actually the password should not be the access token. Standalone SnappyMail Google auth extension uses the OpenID Connect |
@the-djmaze I understand your change in the most recent commit now. Would you say the
|
Yes. Email address + app salt. |
@the-djmaze Isn't the email in 6b03820#diff-cbd3c0fe0c611f44da419210ab32e2b7bcf995aae9517b01fb8287bf1c2eafc7R46 stored on server? |
Yes, so it reopens the issue: If there is a way in Nextcloud to have something from OIDC that is not stored on server then it is fine. |
Description:
We have identified an issue involving the
.cryptkey
file that causes errors when switching accounts after using both SSO and Non-SSO login methods.Steps to Reproduce:
Register a new account .
Log in with SSO and add an additional account via SSO. A
.cryptkey
file is created instorage/domain/user/.cryptkey
.Attempt to switch between the accounts — it works as expected.
Log out and log back in without using SSO.
Attempt to switch accounts again — an error occurs, and the following error is logged:
[2024-09-11 14:19:32.658][b4f90fd4] JSON[INFO]: {"Action":"AccountSwitch","Result":false,"ErrorCode":803,"ErrorMessage":"AccountSwitchFailed[803]","ErrorMessageAdditional":"CryptKeyError[111]","ExceptionCode":0,"epoch":1726064372}
[2024-09-11 14:19:32.694][b4f90fd4] [INFO]: Memory peak usage: 8MB
[2024-09-11 14:19:32.724][b4f90fd4] [INFO]: Time delta: 0.55190300941467
[2024-09-11 14:19:59.935][3e510555] [INFO]: [SM:2.37.2][IP:2401:4900:1c63:4335:c50:b8c2:84fe:e8f3][PID:1192][nginx/1.24.0][fpm-fcgi][Streams:tcp,udp,unix,udg,ssl,tls,tlsv1.0,tlsv1.1,tlsv1.2,tlsv1.3][POST https://xxxxx.com/apps/snappymail/?/Json/&q[]=/0/]
[2024-09-11 14:19:59.975][3e510555] Nextcloud[DEBUG]: integrated
[2024-09-11 14:20:00.034][3e510555] JSON[INFO]: Action: DoAppDelayStart
[2024-09-11 14:20:00.069][3e510555] POST[INFO]: {"Action":"AppDelayStart"}
[2024-09-11 14:20:00.100][3e510555] COOKIE[DEBUG]: set smtoken
[2024-09-11 14:20:00.130][3e510555] JSON[INFO]: {"Action":"AppDelayStart","Result":true,"epoch":1726064400}
[2024-09-11 14:20:00.170][3e510555] [INFO]: Memory peak usage: 6MB
[2024-09-11 14:20:00.204][3e510555] [INFO]: Time delta: 0.43127679824829
The text was updated successfully, but these errors were encountered: