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

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 19:25:58 +00:00
parent 5371382cb4
commit 0e4f7fe72c
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: A `secret add --force` that cannot unlock the vault, given a wrong
passphrase or mnemonic, leaves the secret as it was
(https://git.eeqj.de/sneak/secret/issues/136). The new version used to be