fix(core): save the session by replacing its keyring item (#78, B291)

Fedora 45 and 46 ship oo7-daemon 0.7.0~beta^1.e91b98a, which applies
SetSecret only in memory (fixed upstream in 7fb11dd, after that
snapshot). Every token rotation saved there was lost at the next
reboot, and the next start found a spent refresh token.

An existing entry is now written with CreateItem and replace, in the
old item's collection with its label and attributes, which that build
persists. A duplicate left behind is removed; the first save, a locked
item, ambiguity or any failure fall back to SetSecret. No prompt is
ever shown on this path.

The daemon also logs a short fingerprint of the refresh token at each
resume and each save, so a log across a reboot shows whether the
keyring returned the last token saved.
This commit is contained in:
nvrl committed 2026-11-15 20:31:43 +01:00
1 parent ce3bfa217d
commit 64864562ef
9 files changed
+323 -8

No files matched your search

+42
View File
@@ -109,6 +109,7 @@ a live account since.
| Entry | Title |
|---|---|
| [B291](#b291--on-fedora-45s-oo7-every-saved-sign-in-is-lost-at-the-next-reboot) | On Fedora 45's oo7, every saved sign-in is lost at the next reboot |
| [B289](#b289--the-takeout-import-mixes-in-other-services-and-drops-location-and-live-photos) | The Takeout import mixes in other services and drops location and live photos |
| [B288](#b288--an-interrupted-takeout-import-reads-as-finished-and-one-error-ends-it) | An interrupted Takeout import reads as finished, and one error ends it |
| [B287](#b287--a-photo-draft-left-by-an-interrupted-upload-blocks-that-name) | A photo draft left by an interrupted upload blocks that name |
@@ -393,6 +394,45 @@ a live account since.
Newest first.
### B291 — On Fedora 45's oo7, every saved sign-in is lost at the next reboot
**Status:** Fixed, not verified live
**Found:** 2026-11-15, from the reporter's package list in
[issue #78](https://github.com/narrrl/proton-drive-linux/issues/78): `oo7-daemon-0.7.0~beta^1.e91b98a`,
the build Fedora 45 and 46 ship as stable, from before oo7's
[7fb11dd](https://github.com/linux-credentials/oo7/commit/7fb11dd111c4be8fec01996e3caa31c44fa962b3)
("server: Write item changes to the keyring file"). See
[the investigation](ISSUE-78.md#setsecret-is-kept-only-in-memory-in-fedoras-oo7).
**Where:** `crates/pdfs-core/src/auth.rs`, `write_stored`; `crates/pdfs-core/src/secretservice.rs`
**Repro:** With oo7-daemon at e91b98a, save the session blob, save it again with a new refresh
token, and restart oo7-daemon. The read after the restart returns the first blob. The keyring
store writes an existing item with `SetSecret`, and that oo7 build applies `SetSecret` only to the
item in memory; the keyring file keeps what `CreateItem` wrote. Within a boot every read returns
the new tokens, so nothing looks wrong. After a reboot the daemon resumes with the refresh token
of the last `pdfs login`, which Proton spent long ago: `InvalidRefreshToken`, and the user has to
sign in again. Typing the password at login, or the fixes for B284 and B285, change nothing.
**Cause:** A bug in that oo7 build, fixed in oo7 0.7.0 but not packaged by Fedora. Every token
refresh pdfs saved went through the one call it does not persist.
**Fix:** An existing entry is saved by `CreateItem` with `replace`, which that build writes to the
file: a new item in the old one's collection, with its label and all its attributes, so the
provider replaces the old one. A duplicate that a provider leaves behind is removed; if it cannot
be, the new item is taken out again and the save falls back to the usual `SetSecret`. The first
save, a locked item, two matching items, or any failure before the new item exists also fall back
to it. The connection used for this never shows a prompt. The daemon log now has a short
fingerprint of the refresh token at each start and each save, so a log across a reboot shows
whether the keyring returned the last token saved.
**Verified:** 2026-11-15, `real_secret_service_keeps_the_last_save_across_a_provider_restart`
(ignored; needs a throwaway Secret Service) against oo7-daemon built at e91b98a: with the
in-place write it reads `r1` after the restart, with this change `r3` and one item. The same test
and `real_secret_service_survives_a_provider_restart` pass against gnome-keyring. Not yet run on
a Fedora 45 desktop with a real account.
---
### B290 — Reopening the database right after closing it can be refused as another daemon
**Status:** Fixed, 2026-11-15
@@ -417,6 +457,8 @@ second later.
**Verified:** `cargo test -p pdfs-core` on 2026-11-15, including
`a_second_writer_is_refused_while_the_first_holds_the_database`.
---
### B289 — The Takeout import mixes in other services and drops location and live photos
**Status:** Fixed, not verified live
+7 -7
View File
@@ -162,13 +162,13 @@ Existing folders stay device backups. Older builds cannot open the upgraded data
screen there, and with nothing to scroll no more were loaded. More now load whenever the photos
don't fill the window, also after a zoom or a resize.
- **Signed out after a cold boot on Fedora 45** (issue #78, B284, B285). Fedora 45 replaced the
GNOME keyring with oo7, and two things there could keep a refreshed sign-in from being saved:
oo7 reports the entries of a locked keyring as missing, which the client took for a sign-out,
and a restarted oo7 no longer knew the client's connection, which then failed every save until
the service restarted. The refreshed sign-in lived only in memory, and the next boot found the
spent one. The client now keeps such a sign-in and saves it once the keyring can be read, and
reconnects to a keyring service that restarted.
- **Signed out after every reboot on Fedora 45** (issue #78, B284, B285, B291). Fedora 45 replaced
the GNOME keyring with oo7, and the oo7 build it ships keeps a changed keyring entry only in
memory: every refreshed sign-in the client saved was gone after a reboot, and the next start
found one Proton had already retired. The client now saves the sign-in as a new entry that
replaces the old one, which that oo7 does write to disk. It also no longer drops a refreshed
sign-in when oo7 reports the entries of a locked keyring as missing, and it reconnects to a
keyring service that restarted.
- **Thumbnails appear in the folder you are looking at as soon as they are made.** During
**Build thumbnails**, the folder on screen kept its file icons until you left it and opened it
+46
View File
@@ -58,6 +58,52 @@ can resolve the default alias to a locked collection. Both have fixes in
after the reporter's November 7 retest. Neither can be assigned as this report's cause without
matching runtime evidence.
## SetSecret is kept only in memory in Fedora's oo7
Follow-up on 2026-11-15. The reporter's `rpm -qa 'oo7*'` shows
`oo7-daemon-0.7.0~beta^1.e91b98a-1.fc45`, not the 0.7.0 release assumed above. Bodhi lists that
build as the stable oo7 for Fedora 45 and 46; neither has 0.7.0 or 0.7.1. Commit e91b98a
(October 24) predates
[7fb11dd](https://github.com/linux-credentials/oo7/commit/7fb11dd111c4be8fec01996e3caa31c44fa962b3)
(October 28): "Setting the Label or Attributes of an item, or calling SetSecret, only changed the
item in memory, so the old values came back once the daemon restarted." 0.7.0 carries it as
37e3334.
pdfs writes an existing entry with `SetSecret`, so on that build every saved token rotation was
lost at the next reboot. This explains the reporter's log: the keyring was unlocked one second
before pdfs started (they type their password at login) and still held a spent refresh token.
It does not need a locked keyring or a restarted provider.
pdfs now saves an existing entry with `CreateItem` and `replace` instead
(`crates/pdfs-core/src/secretservice.rs`, B291), which e91b98a writes to the keyring file.
Reproduced and verified with oo7-daemon built at e91b98a in a throwaway session bus:
```sh
git clone https://github.com/linux-credentials/oo7.git /tmp/oo7 && git -C /tmp/oo7 checkout e91b98a
cargo build --manifest-path /tmp/oo7/Cargo.toml -p oo7-daemon --bin oo7-daemon
OO7=/tmp/oo7/target/debug/oo7-daemon
T=$(mktemp -d /tmp/ss.XXXX); mkdir -p $T/data $T/run; chmod 700 $T/run
XDG_DATA_HOME=$T/data XDG_RUNTIME_DIR=$T/run OO7=$OO7 PDFS_SECRET_SERVICE_RESTART_TEST=1 \
PDFS_RESTART_PROVIDER='pkill -x oo7-daemon; sleep 1; (printf pw | setsid "$OO7" --login >/dev/null 2>&1 &); sleep 2' \
dbus-run-session -- sh -c 'printf pw | setsid "$OO7" --login >/dev/null 2>&1 & sleep 2;
cargo test -p pdfs-core real_secret_service_keeps -- --ignored'
```
With the in-place write, the read after the restart returns the first of three saves (`r1`);
with the replacing write it returns the last (`r3`), and one item is left.
The daemon also logs a short fingerprint of the refresh token when it resumes the stored session
and each time it saves a rotation (`refresh=1a2b3c4d`). If a start is refused, compare the
fingerprint it resumed with against the last one saved in the boot before:
```sh
journalctl --user -b -1 -u proton-drive.service | grep -E 'refresh=' | tail -2
journalctl --user -b 0 -u proton-drive.service | grep -E 'refresh=' | head -2
```
The same fingerprint means the keyring kept the last save and Proton refused it; a different one
means the keyring lost it.
## A restarted Secret Service
A second path to the same symptom, independent of locking (B285). The keyring store pdfs used