fix(auth): skip agent keys with comment (none)
Testing / test (push) Successful in 29s

gpg-agent retains YubiKey entries after card removal but resets the
comment to "(none)". Treating those as valid keys causes auth to
succeed against a ghost identity — skip them so the caller gets None
and the missing-card error path fires correctly.
This commit is contained in:
2026-05-03 17:08:26 +02:00
parent 533e9d328d
commit 30a42ba6d5
+2
View File
@@ -103,6 +103,8 @@ def agent_find_key(selector: str | None = None) -> AgentKey | None:
except Exception:
return None
for key in keys:
if key.comment == "(none)":
continue
if selector is None or selector in key.comment:
return key
return None