Use gpg.conf's default-key when unlocker add pgp has no --keyid (closes #141)
check / check (push) Waiting to run

getDefaultGPGKey took the default-key value from `gpgconf --list-options
gpg` as printed. gpgconf prints a string value with a leading `"` and
percent-escaped, so gpg rejected the key ID. The parsing moved into
parseDefaultGPGKey, which drops the `"` and percent-decodes the rest with
url.PathUnescape, which leaves `+` alone. A value that does not decode is
an error, not a fallback to the first secret key.

Rule suppressed: gosec G703 on the test's write of gpg.conf into the
GNUPGHOME directory newTestGPGKey made.

Model: opus-5-5
This commit is contained in:
2026-10-14 20:40:52 +00:00
committed by clawbot
parent fe94e99801
commit 9ae4b74ee7
3 changed files with 108 additions and 6 deletions
+6
View File
@@ -18,6 +18,12 @@ https://git.eeqj.de/sneak/secret/milestone/12
# Completed Steps
- 2026-10-14: `secret unlocker add pgp` without `--keyid` uses the `default-key`
set in `gpg.conf` (https://git.eeqj.de/sneak/secret/issues/141). The key ID
came from `gpgconf --list-options gpg`, which prints a string value with a
leading `"` and percent-escaped, and was passed to gpg undecoded, so gpg
rejected it. The value is now decoded first. With no `default-key` set, the
first secret key is still used.
- 2026-10-14: `secret generate mnemonic`, `secret vault list` and
`secret unlocker list` print their output to stdout, as `secret list` does, so
it can be piped or captured (https://git.eeqj.de/sneak/secret/issues/138).