-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
TOTP setup dialog should strip newlines #6599
Description
Overview
Totp setup dialog should strip newlines.
Steps to Reproduce
Some websites provide the TOTP secret with this HTML markup:
<div>
<p>ABCD EFGH IJKL MNOP</p>
</div>If you triple-click the TOTP, copy it, and then paste into the TOTP setup dialog, then it will give the error "You have entered an invalid secret key. The key must be in Base32 format."
If you paste it into a text document you will see that there are two newlines before the code, and one newline after it:
ABCD EFGH IJKL MNOP
Expected Behavior
This code should also remove newlines.
keepassxc/src/gui/TotpSetupDialog.cpp
Lines 47 to 49 in 11afd73
| // Secret key sanity check | |
| // Convert user input to all uppercase and remove '=' | |
| auto key = m_ui->seedEdit->text().toUpper().remove(" ").remove("=").toLatin1(); |
Actual Behavior
"You have entered an invalid secret key. The key must be in Base32 format."
Context
I have encountered this problem on several websites. For example, Twitter has this problem.
Debug info
KeePassXC - Version 2.6.4
Revision: b93fbd1
Qt 5.15.2
Debugging mode is disabled.
Operating system: macOS 11.4
CPU architecture: arm64
Kernel: darwin 20.5.0
Enabled extensions:
- Auto-Type
- Browser Integration
- SSH Agent
- KeeShare (only unsigned sharing)
- YubiKey
- TouchID
Cryptographic libraries:
- libgcrypt 1.9.1