-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Log Out when Nextcloud logs out #380
Comments
That's strange, when a user logs out of Nextcloud, their session data should be deleted. |
A possible issue might be that indexedDB data is not cleared. Let's see if that can be cleared on logout |
Can I help you somehow to debug this? |
Maybe it is about cookies that are not deleted, I logged out and 9 cookies left on nextcloud, maybe it is because the website tries OIDC in iFrame and it fails and opens the full frame website. If I then go in to a new tab or back and log out I can't access it initially, but logging in with whatever account into nextcloud gives me access to the chats of the logged in person. This means: If I log in on the computer of some college (if used in a company) and log out again and he logs into his nextcloud account he can see my chats and write as he was me. |
What I'm thinking is we can set up an extra script loaded on logout that also deletes indexedDB data. That is where Element stores the access token. |
Maybe, could you reproduce this security bug? If I can assist, let me know, I could give you a dummy account on my server. Also does this version of Element deletes the encrytion key for E2EE chats, are these somehow saved in nextcloud? If yesy the E2EE would be broken (aa the server has the keys). |
E2EE keys are kept in indexedDB storage on the client and are never sent to the Nextcloud server. Feel free to reopen the issue if #383 hasn't fixed your issue. |
@gary-kim Sadly it didn't fix the issue. I first thought as I am using OpenID Connect and he makes the website fullscreen (after first login doesn't work), that it is about the cookies the browser saved from matrix.my-domain.com (that got saved) instead of nextcloud.my-domain.com but after logout, closing, new window, logging in with another account I am logged in (in frame) with the first account. After login again I have the following cookes, all for nextcloud.my-domain.com:
I can send you two credentials for test accounts at my server and you can try. Or what information would be useful to debug it? |
I am doing this whole thing in icognito mode in the new Edge Browser with moderate tracker settings (default). |
Okay, a few things have to be made clear, cookies are not used for Matrix anywhere outside of the SSO specification. Only the Matrix access token is used to authenticate requests and that is stored in indexedDB. Your list seems to specify that there is an indexedDB entry left for Nextcloud which should not exist. With the latest update, I can confirm that with both Chromium and Firefox, using the Nextcloud logout button to log out of Nextcloud will log the user out of both Nextcloud and Element. Are you having a more specific issue? Yes, the session should be left over on the Synapse side. It would require more code to delete the session properly and that does not exist at the moment. |
I tried in Chrome also and I tried it there. The following I do: I am using docker nextcloud-fpm, so your application lands in custom_apps folder. Is there any way I can help debug this? |
I have an idea, don't know if it will work: https://matrix.org/docs/spec/client_server/latest#post-matrix-client-r0-logout 5.5.3 describes a logout. If nextclouds logout is triggered and we could send to the matrix server a logout signal this should solve this problem (if all databases are deleted in nextcloud, like you merged) and even deletes this device from the list of devices for this user in matrix. @gary-kim what do you think about this? |
The how to log out has never been the issue. The issue is that Element sometimes stores the access token encrypted and the access token is needed to log out. Now, the pickle key is stored next to the access token and Element is open source so we can just use their decryption code but Webpack tree shaking doesn't do a good job of reducing the file size of that so it ends up being something like a 30MB script to just decrypt the access token. We could also reimplement the decryption but that would break again as soon as Element changes anything about it. Basically, for now, the priority is to ensure that the account cannot be accessed after logging out from Nextcloud. Making sure it is logged out on the Matrix Homeserver side would be nice as well but I personally have neither a plan or the time to implement that at the moment. Of course, always open for PRs. |
@gary-kim I didn't know this was that complicated, I thought we just send a command like POST /_matrix/client/r0/logout HTTP/1.1 I found out, that there is in cookies a folder called 'Local Storage' (Lokaler Speicher), in this folder is an icon for a database with the name displayed from the url of nextcloud (with https://nextcloud.my-domain.com). If I delete this manually I get logged out, so it seems somehow it doesn't delete this database at logout at my browser (trying right now with Chrome). I tried with an extension diabling Content Security Policy (don't know form where right now the frame-src errors are coming from, I actually allowed the SSO and synapse urls to be frame-src and frame-ancestors and also nextcloud, still errors. |
Ok, so if I log in via a normal account or via an account through LDAP seems to work. Of course I have to disable the SSO session manually as it is not deleted if I logout of nextcloud.
Maybe this plugin somehow is in conflict with this. This plugin only uses SSO to authenticate, data is retrieved via LDAP. I tried without retriebing data from LDAP. |
@gary-kim The Also, it seems to be an issue with: |
Did you run |
No, I just nano into the file and put after all the deletion this console.log command. And when logging out via LDAP I can see this command, so it seems to be that while the Nextcloud user is logged in via oidc that this script isn't called. Somehow oidc and riotchat does not seem to work with each other. I know that the problem seems to be with the redirect url, somehow it doesn't trigger your script. You can see more in the issue I linked. |
pulsejet/nextcloud-oidc-login#164 fixed this, this was a problem in this oidc plugin, nothing to do with riotchat. |
@gary-kim should we open for that another issue / feature request? Would be probably better, right? |
I can confirm that loggin out on Nextcloud and loggin back yields the previous account on the app still being logged in. |
On Wed Jun 5, 2024 at 11:52 AM EDT, WaaromZoMoeilijk wrote:
I can confirm that loggin out on Nextcloud and loggin back yields the previous account on the app still being logged in.
If there's anything I can help with to get some momentum going on this, please let me know.
Anyone is welcome to make a pull request or send a patch (even with
git-send-email, if you prefer) fixing any issues.
I, unfortunately, cannot reproduce this issue (I just tried on my
install) without more information.
|
Hi, i have the same problem. The thirst time i had it on a nextcloud community edition. Now i have the problem on a hetzner storage share (Nextcloud). I Can login in the Nextcloud Element integration, but if i log me out of the nextcloud it logs out the element too. Is there a solution? Thanks a lot. |
What information can i give to you? (And there will i find it?) |
@thoys1 It seems like you want the opposite of what this issue was originally about (not logging out of Element Web when logging out of Nextcloud)? |
Hi,
right now I am using both nextcloud and this app via OIDC (OpenID Connect), the iframe problem is still a problem, don't know why, put the frame-src into keycloak and nginx, but didn't work.
But the more problematic thing is, that synapse doesn't automatically logs sessions out, so when I log out with the nextcloud account and somebody else goes onto the computer and into the browser and logs into with their nextcloud account they are logged in into my messages.
Is it possible to send a logout message to synapse/matrix when nextcloud is logged out?
This feature request tries the complete opposite, so maybe this should be a toggle (on by default to log you out, as it is much more secure).
#114
The text was updated successfully, but these errors were encountered: