Skip to content

TOTP setup dialog should strip newlines #6599

@stefansundin

Description

@stefansundin

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.

// 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions