gitbutlerapp / gitbutler

The GitButler version control client, backed by Git, powered by Tauri/Rust/Svelte
https://gitbutler.com
Other
13.45k stars 531 forks source link

Access token for user was deleted from keychain - login is now invalid #5493

Open n-a-m-e opened 3 weeks ago

n-a-m-e commented 3 weeks ago

Version

0.13.12

Operating System

Linux

Distribution Method

deb (Linux)

Describe the issue

I am using a Fedora Atomic Desktop (https://getaurora.dev/) which means that the base OS is read only.

I am running into the same issue with the flatpak and the rpm. Everything works normally i can push pull merge etc. but if I close Gitbutler and then reopen it I have go to Preferences > Integrations and sign in again and then re authorize github.

I have a feeling that gitbutler is trying to save the Access Token somewhere that is read only. Which directory on the host file system is is the Access token being saved to?

Below are the relevant logs

ui-logs.log

[2024-11-08][03:09:12][Rt@tauri://localhost/_app/immutable/entry/app.By5TMNpJ.js:2:2973][ERROR] 9a51850b165e44ba9d45f8f7b64ef4f7: Access token for user was deleted from keychain - login is now invalid

s@tauri://localhost/_app/immutable/chunks/ipc.DARP4IML.js:1:734
fromError@tauri://localhost/_app/immutable/chunks/ipc.DARP4IML.js:1:903
@tauri://localhost/_app/immutable/chunks/ipc.DARP4IML.js:1:1111

GitButler.2024-11-08.log

2024-11-08T03:09:12.397252Z  INFO crates/gitbutler-tauri/src/main.rs:62: system git executable for fetch/push: "git"
2024-11-08T03:09:12.397396Z  INFO crates/gitbutler-tauri/src/main.rs:99: starting app version=0.13.12 name=GitButler
2024-11-08T03:09:12.859495Z  INFO get_user: crates/gitbutler-tauri/src/users.rs:10: new
2024-11-08T03:09:12.859856Z  INFO get_user:perform: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:382: new
2024-11-08T03:09:12.859884Z  INFO get_user:perform:write_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:935: new command=Auth(Some(External), Some([49, 48, 48, 48]))
2024-11-08T03:09:12.859899Z  INFO get_user:perform:write_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:935: close time.busy=6.83µs time.idle=8.11µs command=Auth(Some(External), Some([49, 48, 48, 48]))
2024-11-08T03:09:12.859942Z  INFO get_user:perform:read_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:953: new
2024-11-08T03:09:12.859963Z  INFO get_user:perform:read_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:953: close time.busy=13.7µs time.idle=7.58µs
2024-11-08T03:09:12.859977Z  INFO get_user:perform:write_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:935: new command=NegotiateUnixFD
2024-11-08T03:09:12.859992Z  INFO get_user:perform:write_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:935: close time.busy=6.87µs time.idle=7.52µs command=NegotiateUnixFD
2024-11-08T03:09:12.860005Z  INFO get_user:perform:read_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:953: new
2024-11-08T03:09:12.860016Z  INFO get_user:perform:read_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:953: close time.busy=5.47µs time.idle=5.28µs
2024-11-08T03:09:12.860028Z  INFO get_user:perform:write_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:935: new command=Begin
2024-11-08T03:09:12.860038Z  INFO get_user:perform:write_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:935: close time.busy=5.59µs time.idle=4.72µs command=Begin
2024-11-08T03:09:12.860052Z  INFO get_user:perform: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:382: close time.busy=187µs time.idle=11.0µs
2024-11-08T03:09:12.860172Z  INFO get_user:socket reader: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/socket_reader.rs:33: new
2024-11-08T03:09:12.868369Z  INFO get_user:perform: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:382: new
2024-11-08T03:09:12.868407Z  INFO get_user:perform:write_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:935: new command=Auth(Some(External), Some([49, 48, 48, 48]))
2024-11-08T03:09:12.868421Z  INFO get_user:perform:write_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:935: close time.busy=8.71µs time.idle=4.70µs command=Auth(Some(External), Some([49, 48, 48, 48]))
2024-11-08T03:09:12.868452Z  INFO get_user:perform:read_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:953: new
2024-11-08T03:09:12.868466Z  INFO get_user:perform:read_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:953: close time.busy=10.7µs time.idle=3.46µs
2024-11-08T03:09:12.868484Z  INFO get_user:perform:write_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:935: new command=NegotiateUnixFD
2024-11-08T03:09:12.868495Z  INFO get_user:perform:write_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:935: close time.busy=8.30µs time.idle=2.86µs command=NegotiateUnixFD
2024-11-08T03:09:12.868507Z  INFO get_user:perform:read_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:953: new
2024-11-08T03:09:12.868517Z  INFO get_user:perform:read_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:953: close time.busy=6.61µs time.idle=3.06µs
2024-11-08T03:09:12.868529Z  INFO get_user:perform:write_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:935: new command=Begin
2024-11-08T03:09:12.868538Z  INFO get_user:perform:write_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:935: close time.busy=6.09µs time.idle=2.85µs command=Begin
2024-11-08T03:09:12.868549Z  INFO get_user:perform: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:382: close time.busy=160µs time.idle=21.8µs
2024-11-08T03:09:12.868549Z  INFO get_user:socket reader: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/socket_reader.rs:33: close time.busy=287µs time.idle=7.63ms
2024-11-08T03:09:12.868623Z  INFO get_user:socket reader: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/socket_reader.rs:33: new
2024-11-08T03:09:12.876270Z  INFO get_user:socket reader: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/socket_reader.rs:33: close time.busy=156µs time.idle=7.49ms
2024-11-08T03:09:12.876357Z  INFO get_user:perform: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:382: new
2024-11-08T03:09:12.876374Z  INFO get_user:perform:write_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:935: new command=Auth(Some(External), Some([49, 48, 48, 48]))
2024-11-08T03:09:12.876384Z  INFO get_user:perform:write_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:935: close time.busy=7.20µs time.idle=2.96µs command=Auth(Some(External), Some([49, 48, 48, 48]))
2024-11-08T03:09:12.876402Z  INFO get_user:perform:read_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:953: new
2024-11-08T03:09:12.876412Z  INFO get_user:perform:read_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:953: close time.busy=6.74µs time.idle=3.75µs
2024-11-08T03:09:12.876423Z  INFO get_user:perform:write_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:935: new command=NegotiateUnixFD
2024-11-08T03:09:12.876434Z  INFO get_user:perform:write_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:935: close time.busy=8.21µs time.idle=2.66µs command=NegotiateUnixFD
2024-11-08T03:09:12.876445Z  INFO get_user:perform:read_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:953: new
2024-11-08T03:09:12.876492Z  INFO get_user:perform:read_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:953: close time.busy=9.40µs time.idle=37.0µs
2024-11-08T03:09:12.876505Z  INFO get_user:perform:write_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:935: new command=Begin
2024-11-08T03:09:12.876512Z  INFO get_user:perform:write_command: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:935: close time.busy=4.58µs time.idle=2.48µs command=Begin
2024-11-08T03:09:12.876524Z  INFO get_user:perform: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/handshake.rs:382: close time.busy=124µs time.idle=42.5µs
2024-11-08T03:09:12.876565Z  INFO get_user:socket reader: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/socket_reader.rs:33: new
2024-11-08T03:09:12.886663Z ERROR get_user: crates/gitbutler-tauri/src/users.rs:10: error=Error(Please login to GitButler again

Caused by:
    access token for user was deleted from keychain - login is now invalid)
2024-11-08T03:09:12.886681Z  INFO get_user:socket reader: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-3.15.2/src/socket_reader.rs:33: close time.busy=211µs time.idle=9.90ms
2024-11-08T03:09:12.886738Z  INFO get_user: crates/gitbutler-tauri/src/users.rs:10: close time.busy=27.2ms time.idle=25.0µs
2024-11-08T03:09:12.970871Z  INFO list_projects: crates/gitbutler-tauri/src/projects.rs:46: new
2024-11-08T03:09:12.970958Z  INFO list_projects: crates/gitbutler-tauri/src/projects.rs:46: close time.busy=59.9µs time.idle=28.8µs
2024-11-08T03:09:13.154357Z  INFO list_projects: crates/gitbutler-tauri/src/projects.rs:46: new
2024-11-08T03:09:13.154454Z  INFO list_projects: crates/gitbutler-tauri/src/projects.rs:46: close time.busy=60.4µs time.idle=40.2µs

How to reproduce

No response

Expected behavior

No response

Relevant log output

No response

Byron commented 3 weeks ago

GitButler uses the keyring crate to store and retrieve credentials. And by the looks of it, it's not actually persisting secrets on this system.

Since it's not permanently failing, it feels like either it's keeping secrets for the session only, or the UI saves tokens in its own in-memory store.

There is something you could try if you could compile the application on your own with the following patch applied…

diff --git a/crates/gitbutler-tauri/src/main.rs b/crates/gitbutler-tauri/src/main.rs
index 5e7465ce4..88de94b3d 100644
--- a/crates/gitbutler-tauri/src/main.rs
+++ b/crates/gitbutler-tauri/src/main.rs
@@ -68,7 +68,7 @@ fn main() {
                     // the binary is rebuilt. To counter that, use a git-credential based implementation.
                     // This isn't an issue for actual release build (i.e. nightly, production),
                     // hence the specific condition.
-                    if cfg!(debug_assertions) && cfg!(target_os = "macos") {
+                    if true {
                         gitbutler_secret::secret::git_credentials::setup().ok();
                     }

…to see if that fixes the issue. If so, then using git credentials to store credentials seems to be more portable and might be something that should be exposed in the application settings.

Thanks for your help with this.

ndom91 commented 2 weeks ago

Sounds like an issue with your system keyring. With KDE this should be kwallet5/6. I assume because of the fact that you're running an immutable OS that it is not writeable and/or at least doesn't persist between reboots.

Can you open KWalletManager to see if GitButler is listed in there after opening GitButler and signing in? That will tell us if we were able to successfully save it in your keyring at all to begin with and point to the issue being persistence of your keyring between reboots.

n-a-m-e commented 4 days ago

I did a bit of research, and I compiled git Butler as suggested but that didn't solve it. The problem was stemming from the fact that the default wallet didn't exist or was not unlocked at login since I was using a VNC. I am now unlocking the wallet manually at login and using the new flatpak from here https://github.com/gitbutlerapp/gitbutler/issues/2509#issuecomment-2470904877 and its working.

Byron commented 4 days ago

That's great to hear!

But it also means that the wallet might not actually be usable, and we have no real way to detect this case or fix it, at least not without having non-portable code specifically for this case.

Regarding the custom build, did you also apply the patch shown in this comment? With it, it uses git itself for storing and retrieving credentials, but of course, chances are that it has exactly the same problems.