Let a sign-out finish when a row's binding columns cannot be read
SqliteKeyStore::list() failed on the first row whose binding columns were damaged outside this crate (synced = 2 on the account record, say), and KeyStore::sign_out starts with list() through bound_to(): it never reached the record, so it could never finish, and DeviceKeyChoice::Forget did not delete the key it was given either. get() failed the same way where sign_out reads the record and the device key. A row whose binding columns cannot be read (refused by AccountBinding::from_columns, or a value of the wrong type) is now listed and read as unbound, with a tracing warning that names the row and the reason and quotes no content. Unbound is the reading that never deletes on a guess: such a row is not deleted as a synced copy, and a put of it writes four good columns. A data column that is not text is read as text with the odd bytes replaced, so a record that cannot be read is deleted by the trait's sign_out instead of its read failing; a row whose kind or uid is not text cannot be addressed and the list leaves it out with a warning. list() now fails only when the database does. Tests: the gate's probe (UPDATE identities SET synced = 2 WHERE kind = 'account', then sign_out with Auto and with Forget on a store with bound_existing_key true and false), more damage to the record row, the device key row and a synced copy, and the unreadable data and kind/uid cases; the test that asserted the old precise errors of get() and list() now asserts the unbound reading. The six new tests fail on the previous keystore.rs. voelin-store gets the tracing dependency (already in the lock); Cargo.lock changes, THIRD_PARTY_NOTICES.md is unchanged by it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7c6d149f78
commit
4944a0694b
5 files changed
+382
-59
No files matched your search
@@ -349,6 +349,10 @@ names (the error says only that, never the JSON: it is a private key), and
|
||||
the TeamSpeak security level is still computed from the key, never stored. A
|
||||
`put` that changes only the binding of a row does not read its JSON again, so a
|
||||
row damaged outside the client cannot keep a sign-out from unbinding it.
|
||||
A row whose binding columns cannot be read is listed and read as unbound, with a
|
||||
warning, instead of failing the list; so no damaged row, the account record's
|
||||
included, keeps a sign-out from finishing, and `Forget` still deletes the key
|
||||
it names.
|
||||
Signing out of an account is the trait's `sign_out`, run on this table: it
|
||||
removes the account record and the synced copies, unbinds the identities only
|
||||
this device holds, keeps the device key (unbound, byte for byte) when the
|
||||
|
||||
Reference in new issue
Block a user