Keepassxc: cannot copy TOTP attributes to clipboard

Created on 28 Feb 2018  路  10Comments  路  Source: keepassxreboot/keepassxc

The Copy attribute to clipboard > TOTP Seed and Copy attribute to clipboard > TOTP Settings menu options don't seem to work correctly.

Expected Behavior

I would expect that the Seed/Settings get copied to the clipboard as the name on the tin would indicate.

Current Behavior

The clipboard appears to be cleared when these menu options are used.

Possible Solution

Unknown.

Steps to Reproduce (for bugs)

  1. Test the clipboard first, by copying something to the clipboard and pasting it
  2. Right click an entry in the list with a TOTP seed tied to it
  3. Select Copy attribute to clipboard > TOTP Seed
  4. Try pasting, and note that nothing is pasted -- not even the test string from step 1. The clipboard appears to have been set to an empty string?

Context

It doesn't bother me, as I don't use the feature. But I noticed it wasn't working when I tried it wondering what it would copy.

Debug Info

KeePassXC - Version 2.3.0-snapshot
Build Type: Snapshot
Revision: 3f7f1aa

Libraries:

  • Qt 5.10.1
  • libgcrypt 1.8.2

Operating system: Arch Linux
CPU architecture: x86_64
Kernel: linux 4.15.5-1-hsw

Enabled extensions:

  • Auto-Type
  • Browser Integration
  • SSH Agent
  • YubiKey
not reproducible

All 10 comments

All customs attributes aren't copy to clipboard.

Try add a test propertie and select Copy attribute to clipboard > TOTP Seed
nothing in clipboard.

Title + URL work.

Works for me. Please check your clipboard timeout settings. KeePassXC will clear the clipboard after a few seconds.

It's set to clear the clipboard after 10 seconds, and I'm well under that time limit.

I experience the same behavior as @OlivierMary -- the Title, Username, Password, current TOTP code, etc all copy to the clipboard correctly. The TOTP settings/seed do not.

I suspect this is related to #1546.
I need to dive into the code

I complete / correct my last comment

Try add a test propertie and select Copy attribute to clipboard > **test**
I got nothing in clipboard.

I observe that on Linux, not on windows.

I can't reproduce this neither with 2.3.0 and also with release/2.3.1 branch

Please insert step to reproduce

diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp
index e4ee21a3..2e97c3f8 100644
--- a/src/gui/DatabaseWidget.cpp
+++ b/src/gui/DatabaseWidget.cpp
@@ -597,6 +597,10 @@ void DatabaseWidget::copyAttribute(QAction* action)
     if (!currentEntry) {
         return;
     }
+       printf("Copying attribute %s, value is '%s' with placeholders resolved '%s'\n",
+                       action->text().toLatin1().data(),
+                       currentEntry->attributes()->value(action->text()).toLatin1().data(),
+                       currentEntry->resolveMultiplePlaceholders(currentEntry->attributes()->value(action->text())).toLatin1().data());

     setClipboardTextAndMinimize(currentEntry->resolveMultiplePlaceholders(currentEntry->attributes()->value(action->text())));
 }

Shows:

Copying attribute TOTP &Seed, value is '' with placeholders resolved ''

Seems like it should be dead-easy to reproduce.

Slightly further:

diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp
index e4ee21a3..1468241a 100644
--- a/src/gui/DatabaseWidget.cpp
+++ b/src/gui/DatabaseWidget.cpp
@@ -597,6 +597,16 @@ void DatabaseWidget::copyAttribute(QAction* action)
     if (!currentEntry) {
         return;
     }
+       printf("Copying attribute %s, value is '%s' with placeholders resolved '%s'\n",
+                       action->text().toLatin1().data(),
+                       currentEntry->attributes()->value(action->text()).toLatin1().data(),
+                       currentEntry->resolveMultiplePlaceholders(currentEntry->attributes()->value(action->text())).toLatin1().data());
+
+       printf("Attribute keys:\n");
+       for (QString key : currentEntry->attributes()->keys())
+       {
+               printf("  '%s'\n", key.toLatin1().data());
+       }

     setClipboardTextAndMinimize(currentEntry->resolveMultiplePlaceholders(currentEntry->attributes()->value(action->text())));
 }
Copying attribute TOTP &Seed, value is '' with placeholders resolved ''
Attribute keys:
  'Notes'
  'Password'
  'TOTP Seed'
  'TOTP Settings'
  'Title'
  'URL'
  'UserName'

It's the & that appears to be screwing it up.

Are you using KDE as desktop environment?
https://keepassxc.org/docs/#faq-kdeaccelerators

Now I remember :smile:

Closing since the solution is in the faq and this is not a KeePassXC bug

Was this page helpful?
0 / 5 - 0 ratings