mirror of
https://github.com/bitcoin-core/gui-qml.git
synced 2026-12-02 07:42:38 +00:00
A passphrase pasted with a trailing line ending is kept byte for byte, so the wallet is encrypted with a character the user cannot see or type #1132
Labels
No labels
Android
Bug
Build system
Design suggestion
Doc
Needs design review
Needs rebase
Stage
UX
Up for grabs
Upstream
Wallet
duplicate
enhancement
good first issue
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin-core/gui-qml#1132
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The password fields keep a pasted line ending as part of the passphrase. A wallet created with
Correct-Horse-7plus a line feed pasted into both fields is not opened byCorrect-Horse-7typed, and nothing on the form shows the extra character. Bitcoin-Qt's field keeps the same bytes.To reproduce:
Correct-Horse-7followed by a line feed on the clipboard.Correct-Horse-7.walletpassphrase "Correct-Horse-7" 5fails with error -14. With the line feed appended it unlocks.Correct-Horse-7typed gives "The wallet password you entered was incorrect." Pasting the same clipboard signs.The last row is the everyday form: a correct passphrase copied with its line ending is refused at an unlock prompt. The lock-out needs the same clipboard in both fields. Masked, the field has one bullet more. With Show password on there is no sign: the text and its width are the same with and without the line feed.
The fields have no validator, the create form trims the name and the xpub but not the passphrase, and the text goes to Core byte for byte:
github.com/bitcoin-core/gui-qml@2bd5a61e83/qml/pages/wallet/CreateWalletForm.qml (L43-L44)github.com/bitcoin-core/gui-qml@2bd5a61e83/qml/util.cpp (L76-L85)Core takes exactly the bytes it is given, and its own tool does not add a line ending by accident:
bitcoin-cli encryptwallet "$(printf 'Correct-Horse-7\n')"encrypts with the 15 characters. Bitcoin-Qt passes itsQLineEdittext on with no trimming, and aQLineEditset up as its dialog sets it up, run on the same Qt 6.9.0, kept all seven clipboards unchanged. With the passphrase shown it draws a line ending as a space, which is the one difference. I did not run Bitcoin-Qt itself.A line ending cannot be typed into these fields, so could pasted ones be dropped, or at least reported? #931 would remove one of the three flows. #1052 at
e89a2bcd4624and #1060 at733018ca9eabadd no filter, by their diffs.Reproduced on
qt6at2bd5a61e8304andeed1f426fcb6, macOS arm64 / Qt 6.9.0, isolated regtest, offscreen only. The paste was not Cmd+V: the clipboard was the offscreen platform's private one, set through the test bridge, and the field's own paste function was called after a forced focus. I have not shown that a real paste from the macOS clipboard delivers the line ending; by Qt's source it does. Which everyday sources leave a trailing line ending on the clipboard was not tested; by its manual,pbcopyfed from a pipeline keeps it. Only LF, CR, TAB and a space were tried, and the Send, Speed up, Receive and migration prompts were not pasted into.