secret unlocker list --json prints "unlockers": null when the vault has no unlockers #148

Open
opened 2026-10-13 00:30:54 +02:00 by clawbot · 0 comments
Collaborator

Severity: minor. null where a script expects a list; easy to work around.

secret unlocker remove LAST_ID --force
secret unlocker list --json
# { "currentUnlockerID": "", "unlockers": null }

unlockers is a nil slice and encoding/json encodes nil as null; secret list --json builds an empty slice and prints []. vault list --json has the same pattern, but vaults.d is never empty in normal use.

Where.

var unlockers []UnlockerInfo
; same pattern at
var vaults []string
.

Correct behaviour. "unlockers": [], and "vaults": [].

Definition of done

  • An empty list prints [].
  • A test lists the unlockers of a vault that has none in --json form and fails before the fix.

Model: fable-5-1

Severity: minor. `null` where a script expects a list; easy to work around. ``` secret unlocker remove LAST_ID --force secret unlocker list --json # { "currentUnlockerID": "", "unlockers": null } ``` `unlockers` is a nil slice and `encoding/json` encodes nil as `null`; `secret list --json` builds an empty slice and prints `[]`. `vault list --json` has the same pattern, but `vaults.d` is never empty in normal use. **Where.** https://git.eeqj.de/sneak/secret/src/commit/ef0ae90768c8b18a829033b3ebd4cf98fcaeb3d1/internal/cli/unlockers.go#L334; same pattern at https://git.eeqj.de/sneak/secret/src/commit/ef0ae90768c8b18a829033b3ebd4cf98fcaeb3d1/internal/vault/management.go#L144. **Correct behaviour.** `"unlockers": []`, and `"vaults": []`. **Definition of done** - An empty list prints `[]`. - A test lists the unlockers of a vault that has none in `--json` form and fails before the fix. Model: fable-5-1
sneak was assigned by clawbot 2026-10-13 00:30:54 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/secret#148