Track SSH agent key ownership by the root group uuid - #13730
Open
underclockeddev wants to merge 1 commit into
Open
underclockeddev wants to merge 1 commit into
underclockeddev wants to merge 1 commit into
Conversation
SSHAgent recorded which database added each key by Database::uuid(). That uuid is generated for every Database object and is not stored in the file, so a reload from disk (which builds a new Database object) orphaned the keys: locking no longer removed them, and unlocking was refused as an ownership conflict. Use the root group uuid instead, which is stored in the file and survives a reload. Two open copies of the same file now share ownership of their keys instead of refusing each other: either one can add them, and locking either removes them. Fixes keepassxreboot#13704 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 task done
droidmonkey
approved these changes
Sep 30, 2026
Member
|
Beautiful |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #13704. Supersedes #13705, per the discussion there.
SSHAgentrecorded which database added each key byDatabase::uuid(), which is generated for everyDatabaseobject and never stored in the file. Anything that builds a newDatabaseobject for the same file orphaned the keys: locking no longer removed them, and unlocking was refused as an ownership conflict. This change keys ownership on the root group uuid instead, which is stored in the file, as suggested in #13704.Two paths that build a new object are fixed by this:
reloadDatabaseFile), for example when a sync tool delivers an edit made on another machine. This includes the hardware-key case: the reload first fails with the key unplugged, then completes once the key is back.unlockDatabase()then replaces the database with a second object.Behaviour change: two copies of the same file open at once now share ownership of their keys instead of refusing each other. Either can add them, and locking either removes them.
testTwoOpenCopiesShareKeyscovers this.The investigation, patch and tests were written with Claude Code (Claude Opus 5.5) and reviewed by me before submitting.
Screenshots
N/A
Testing strategy
TestSSHAgent:testRemoveOnLockAfterReload,testReaddOnUnlockAfterReload,testTwoOpenCopiesShareKeys. With only the tests applied todevelop, all three fail. With the fix, they pass.ctestsuite (non-GUI): 46/46 pass ondevelopand with this change.keepassxcandkeepassxc-cli: ondevelopthe key stays after lock and is not re-added on unlock; with this change both work, and the controls without an external edit behave the same on both builds.Script: https://gist.github.com/underclockeddev/4051fb85ea881fcdecc2841eacc692d1
Type of change