Stop vault creation when a vault's metadata cannot be read (closes #140)
check / check (push) Canceled after 0s

GetNextDerivationIndex passed over a vault whose vault-metadata.json could
not be read or parsed, so the next vault made from the same mnemonic could
get that vault's derivation index and so the same long-term key. It now
returns an error naming the file, and vault create, vault import and init
stop before writing anything. A vault directory with no metadata file is
still passed over.

The regression test corrupts one vault's metadata and requires CreateVault
with the same mnemonic to fail, naming the file, and leave no new vault.

Unverified by test: an unreadable metadata file; checked by hand only.

Model: opus-5-5
This commit is contained in:
2026-10-14 20:57:24 +00:00
parent fe94e99801
commit 75599f1b9d
4 changed files with 53 additions and 7 deletions
+7
View File
@@ -18,6 +18,13 @@ https://git.eeqj.de/sneak/secret/milestone/12
# Completed Steps
- 2026-10-14: Creating a vault, or importing a mnemonic into one, fails with an
error naming the file when any vault's `vault-metadata.json` exists but cannot
be read or parsed, and writes nothing
(https://git.eeqj.de/sneak/secret/issues/140). `vault.GetNextDerivationIndex`
passed over such a vault, so the next vault made from the same mnemonic could
be given its derivation index, and so its long-term key. A vault directory
with no `vault-metadata.json` is still passed over.
- 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).