Skip to content

Username filling wrong value when passkey existed #10840

@silver886

Description

@silver886

Overview

Take NVIDIA and Facebook for example.

When creating an account with email, the email is treated as login username.
Therefore, when user is logging in their account, they are required to provide the email and password.

When user enable passkey, they are still required to give their email and password and passkey is used as multi-factor security.

Expected Behavior

Username is filled into login form when passkey is enabled for the selected entry.

image

Actual Behavior

The KPEX_PASSKEY_USERNAME attribute is filled into login form when passkey is enabled for the selected entry.

image

Update: When I capturing the screenshot, I found that as long as there is an attribute called KPEX_PASSKEY_USERNAME, the username will be overwritten.

Possible Solution

I'm not sure where to fix this.
Maybe here

QJsonObject BrowserService::prepareEntry(const Entry* entry)
{
QJsonObject res;
#ifdef WITH_XC_BROWSER_PASSKEYS
// Use Passkey's username instead if found
res["login"] = entry->hasPasskey() ? passkeyUtils()->getUsernameFromEntry(entry)
: entry->resolveMultiplePlaceholders(entry->username());
#else
res["login"] = entry->resolveMultiplePlaceholders(entry->username());
#endif
res["password"] = entry->resolveMultiplePlaceholders(entry->password());
res["name"] = entry->resolveMultiplePlaceholders(entry->title());
res["uuid"] = entry->resolveMultiplePlaceholders(entry->uuidToHex());
res["group"] = entry->resolveMultiplePlaceholders(entry->group()->name());

?

Steps to Reproduce

  1. Create an account on NVIDIA, Facebook, or any other service which login username is different from passkey user name. (Update: Can be simplified as creating any account.)
  2. Create an entry in KeepassXC.
  3. Setup passkey with KeePassXC-Browser. (Update: Can be simplified as creating KPEX_PASSKEY_USERNAME attribute.)
  4. Logout and login again.
  5. Now KeePassXC-Browser auto fills KPEX_PASSKEY_USERNAME instead of username.

Debug info

KeePassXC - 2.7.8
KeePassXC-Browser - 1.9.0.5
Operating system: Win
Browser: Firefox

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions