Any invalid mnemonic is reported as a checksum failure, including an empty one #76

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

Every way a mnemonic can be invalid is reported as the mnemonic fails its BIP-39 checksum: a mnemonic command that printed nothing, a word count other than 12, 15, 18, 21 or 24, a word that is not on the list (a typo), and an actual checksum mismatch. The README says a mnemonic that fails the checksum is refused "with a message saying so"; the message says so even when the checksum is not the problem, and sends a user whose secret manager printed nothing off to check their words.

Where: internal/mnemonic/mnemonic.go:110-118 (checked) turns every bip39.IsMnemonicValid failure into ErrChecksum, although internal/bip39/bip39.go:41-45 and :78-84 tell the cases apart.

How to see:

./keyfunc age pub --mnemonic-command true
KEYFUNC_MNEMONIC='abandn abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about' ./keyfunc age pub
KEYFUNC_MNEMONIC='abandon abandon abandon' ./keyfunc age pub

All three print the checksum message.

Definition of done: the message says what is wrong: no mnemonic was given (empty output), N words where 12, 15, 18, 21 or 24 are needed, or a word that is not on the list (by position, never the word itself, so the mnemonic stays out of error output). Only a real checksum mismatch mentions the checksum. Tests in internal/mnemonic/mnemonic_test.go for each case, and the README sentence adjusted if the wording changes.

Severity: minor. The mnemonic is refused as it should be; only the explanation is wrong.

Model: fable-5-1

Every way a mnemonic can be invalid is reported as `the mnemonic fails its BIP-39 checksum`: a mnemonic command that printed nothing, a word count other than 12, 15, 18, 21 or 24, a word that is not on the list (a typo), and an actual checksum mismatch. The README says a mnemonic that fails the checksum is refused "with a message saying so"; the message says so even when the checksum is not the problem, and sends a user whose secret manager printed nothing off to check their words. Where: `internal/mnemonic/mnemonic.go:110-118` (`checked`) turns every `bip39.IsMnemonicValid` failure into `ErrChecksum`, although `internal/bip39/bip39.go:41-45` and `:78-84` tell the cases apart. How to see: ./keyfunc age pub --mnemonic-command true KEYFUNC_MNEMONIC='abandn abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about' ./keyfunc age pub KEYFUNC_MNEMONIC='abandon abandon abandon' ./keyfunc age pub All three print the checksum message. **Definition of done**: the message says what is wrong: no mnemonic was given (empty output), N words where 12, 15, 18, 21 or 24 are needed, or a word that is not on the list (by position, never the word itself, so the mnemonic stays out of error output). Only a real checksum mismatch mentions the checksum. Tests in `internal/mnemonic/mnemonic_test.go` for each case, and the README sentence adjusted if the wording changes. Severity: minor. The mnemonic is refused as it should be; only the explanation is wrong. Model: fable-5-1
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/keyfunc#76