[codex] Handle CredWrite logon session failures#152
Draft
SirAndrosBot wants to merge 1 commit into
Draft
Conversation
|
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.



What changed
KeyStorageException, a presentable exception type for user-facing key-storage failures.CredWriteERROR_NO_SUCH_LOGON_SESSION/0x520to a clear warning message when Windows Credential Manager cannot save the database key.CredWritefailures on the existing reportable error path.KeePassWinHello.csprojso the new exception is included in PLGX/legacy builds.Why
Issue #82 reports repeated generic bug-report dialogs from
CredWriteerror0x520while persistent storage is enabled and KeePass is running elevated.Windows error
0x520isERROR_NO_SUCH_LOGON_SESSION: Windows Credential Manager cannot access the relevant logon session for the write. In this case the plugin should not tell users this is an unexpected internal bug; it should explain that the persistent key was not saved and point at the elevated-process condition when applicable.Behavior notes
This PR deliberately does not disable Credential Manager storage, delete persistent Windows Hello keys, or silently fall back to in-memory storage. A first worker pass tried that, but review rejected it as too broad for a possibly transient storage write failure. The final patch is warning-only: it preserves existing persistent-storage state and keeps the failure visible.
Refs #82
Validation
git diff --checkpassed with only Git LF-to-CRLF working-copy warnings.MSBuild.exe src\KeePassWinHello.csproj /t:Rebuild /p:Configuration=Release /p:DefineConstants=MONO /p:FrameworkPathOverride=C:\Windows\Microsoft.NET\Framework\v4.0.30319 /p:ReferencePath=C:\proj\KeePassWinHello\libpassed with 0 warnings and 0 errors.Manual test needed
CredWrite0x520, to confirm the warning appears instead of the generic report dialog.