mirror of
https://github.com/overcuriousity/trace.git
synced 2025-12-20 13:02:21 +00:00
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:
@@ -61,9 +61,9 @@ class Crypto:
|
|||||||
parts = line.split('"')
|
parts = line.split('"')
|
||||||
if len(parts) >= 2:
|
if len(parts) >= 2:
|
||||||
signer_info = parts[1]
|
signer_info = parts[1]
|
||||||
break
|
break # Only break after successfully extracting signer info
|
||||||
elif "using" in line:
|
elif "using" in line:
|
||||||
# Try to get key ID
|
# Try to get key ID as fallback
|
||||||
if "key" in line.lower():
|
if "key" in line.lower():
|
||||||
signer_info = line.strip()
|
signer_info = line.strip()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user