Fix GPG signature verification always showing "Unknown signer"

The verify_signature() function had a logic bug where the break statement
was executed even when quote parsing failed, preventing fallback to the
key ID extraction.

The break was positioned to execute whenever "Good signature from" appeared,
regardless of whether the signer name was successfully extracted from quotes.
This left signer_info as "Unknown signer" when quote parsing failed.

Fix: Move break inside the successful parsing block (if len(parts) >= 2)
so it only breaks after successfully extracting the signer name. If quote
parsing fails, the loop continues and can fall back to extracting the key
ID from the "using" line.

Testing: Created comprehensive test suite verifying correct extraction of
signer information and proper handling of edge cases.
This commit is contained in:
Claude
2025-12-14 13:32:21 +00:00
parent f4f276160a
commit 62fa781350

View File

@@ -61,9 +61,9 @@ class Crypto:
parts = line.split('"')
if len(parts) >= 2:
signer_info = parts[1]
break
break # Only break after successfully extracting signer info
elif "using" in line:
# Try to get key ID
# Try to get key ID as fallback
if "key" in line.lower():
signer_info = line.strip()