Severity: minor
Only a damaged state file reaches it, and secret vault select repairs it; but the wrong answer looks like a healthy, empty vault.
What happens: GetCurrentVault reads the name from currentvault and builds the vault from it without checking that vaults.d/<name> exists, and ListSecrets treats a missing secrets.d as "no secrets". An emptied currentvault yields the name vaults.d (the base of vaults.d/), so the current vault becomes the non-existent vaults.d/vaults.d.
Reproduction, after secret init and echo v | secret add s:
: > "$SB_SECRET_STATE_DIR/currentvault" # or: printf gone > .../currentvault
secret list; echo $?
# No secrets found in current vault.
# Run 'secret add <name>' to create one.
# 0
secret get s # Error: secret s not found
echo v | secret add t # Error: failed to create temporary directory for .../vaults.d/vaults.d/secrets.d/t: ... no such file or directory
secret vault list # Available vaults: default (nothing marked current)
Correct behaviour: when the name in currentvault is empty, invalid (ValidateVaultName) or names no directory under vaults.d, every command that needs the current vault fails with an error naming the file and saying to run secret vault select <name>; secret vault list still lists the vaults.
Definition of done
list, get, add and the other current-vault commands fail with that error on an emptied or wrong currentvault; vault select fixes it.
A test empties currentvault and requires ListSecrets to return an error; it fails before the fix.
Model: fable-5-1
Severity: minor
Only a damaged state file reaches it, and `secret vault select` repairs it; but the wrong answer looks like a healthy, empty vault.
What happens: `GetCurrentVault` reads the name from `currentvault` and builds the vault from it without checking that `vaults.d/<name>` exists, and `ListSecrets` treats a missing `secrets.d` as "no secrets". An emptied `currentvault` yields the name `vaults.d` (the base of `vaults.d/`), so the current vault becomes the non-existent `vaults.d/vaults.d`.
Reproduction, after `secret init` and `echo v | secret add s`:
```
: > "$SB_SECRET_STATE_DIR/currentvault" # or: printf gone > .../currentvault
secret list; echo $?
# No secrets found in current vault.
# Run 'secret add <name>' to create one.
# 0
secret get s # Error: secret s not found
echo v | secret add t # Error: failed to create temporary directory for .../vaults.d/vaults.d/secrets.d/t: ... no such file or directory
secret vault list # Available vaults: default (nothing marked current)
```
`secret info` shows `Current Vault: vaults.d`.
Where: https://git.eeqj.de/sneak/secret/src/commit/ef0ae90768c8b18a829033b3ebd4cf98fcaeb3d1/internal/vault/management.go#L83 (`GetCurrentVault`) and https://git.eeqj.de/sneak/secret/src/commit/ef0ae90768c8b18a829033b3ebd4cf98fcaeb3d1/internal/vault/management.go#L59 (`ResolveVaultSymlink`).
Correct behaviour: when the name in `currentvault` is empty, invalid (`ValidateVaultName`) or names no directory under `vaults.d`, every command that needs the current vault fails with an error naming the file and saying to run `secret vault select <name>`; `secret vault list` still lists the vaults.
**Definition of done**
- `list`, `get`, `add` and the other current-vault commands fail with that error on an emptied or wrong `currentvault`; `vault select` fixes it.
- A test empties `currentvault` and requires `ListSecrets` to return an error; it fails before the fix.
Model: fable-5-1
sneak
was assigned by clawbot2026-10-13 00:38:58 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Severity: minor
Only a damaged state file reaches it, and
secret vault selectrepairs it; but the wrong answer looks like a healthy, empty vault.What happens:
GetCurrentVaultreads the name fromcurrentvaultand builds the vault from it without checking thatvaults.d/<name>exists, andListSecretstreats a missingsecrets.das "no secrets". An emptiedcurrentvaultyields the namevaults.d(the base ofvaults.d/), so the current vault becomes the non-existentvaults.d/vaults.d.Reproduction, after
secret initandecho v | secret add s:secret infoshowsCurrent Vault: vaults.d.Where:
GetCurrentVault) andResolveVaultSymlink).Correct behaviour: when the name in
currentvaultis empty, invalid (ValidateVaultName) or names no directory undervaults.d, every command that needs the current vault fails with an error naming the file and saying to runsecret vault select <name>;secret vault liststill lists the vaults.Definition of done
list,get,addand the other current-vault commands fail with that error on an emptied or wrongcurrentvault;vault selectfixes it.currentvaultand requiresListSecretsto return an error; it fails before the fix.Model: fable-5-1