Skip to content

Select group when adding new credentials#396

Merged
varjolintu merged 1 commit intodevelopfrom
feature/group_selection
Mar 23, 2019
Merged

Select group when adding new credentials#396
varjolintu merged 1 commit intodevelopfrom
feature/group_selection

Conversation

@varjolintu
Copy link
Copy Markdown
Member

@varjolintu varjolintu commented Jan 23, 2019

Allows selecting a group when adding new credentials to KeePassXC from the popup dialog.

A new command get-database-groups is added to the protocol. If older version than KeePassXC 2.4.0 is used, credentials are saved to the default KeePassXC-Browser Passwords group. For saving, both name and group UUID are used.

The groups are read from a dynamic array where each group can contain N children:

{
    name: '<group name>',
    uuid: '<group UUID>',
    children: [...]
}

Fixes #382.
Fixes #388.
Fixes #427.

Related KeePassXC PR: keepassxreboot/keepassxc#2637.

groups_keepassxc

groups_popup

Also, a default group can be set, or the group can be asked every time:
Screen Shot 2019-03-09 at 10 32 40

@droidmonkey
Copy link
Copy Markdown
Member

This is not scalable and could get very confusing for people with many nested groups. Would it be possible to use an accordion type widget that shows only the top level groups, when that group is clicked it should the child, etc etc?

Alternatively a select form element would be better since it would only ever show one group and the whole contents would be visible when dropped down.

@varjolintu
Copy link
Copy Markdown
Member Author

varjolintu commented Jan 24, 2019

I updated the PR to include a tree view. I'll update the KeePassXC side soon.

@varjolintu varjolintu force-pushed the feature/group_selection branch 7 times, most recently from 8a2641c to ece93dc Compare January 24, 2019 13:32
@droidmonkey
Copy link
Copy Markdown
Member

Is the tree collapsed by default? (Should be) the arrows don't seem to indicate the correct state.

@varjolintu
Copy link
Copy Markdown
Member Author

varjolintu commented Jan 24, 2019

@droidmonkey It's not collapsed, or cannot be collapsed. It's just a tree view. What do you suggest instead of the arrows (maybe arrow down like in KeePassXC)? Or should it definitely be able to collapse?

@varjolintu varjolintu force-pushed the feature/group_selection branch from ece93dc to 05a7c0b Compare January 24, 2019 14:47
@varjolintu
Copy link
Copy Markdown
Member Author

I changed the icon to arrow down, indicating open tree. For now.

keepass.updateLastUsed(keepass.databaseHash);
callback(groups);
} else {
console.log('getDatabaseGroups rejected');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you want to show a proper error at this point? Would the CANNOT_DECRYPT_MESSAGE be appropriate here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not appropriate here. The actual decryption is made much earlier. The extension actually doesn't have an error message for failed verification. I'll add it as a separate PR later, because that is something that every protocol command will need.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like "Invalid or corrupt message sent from KeePassXC"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like that yes. Currently the verifyResponse() returns false from multiple reasons, so the message must be a general one. The one you proposed or something like: "Message sent from KeePassXC cannot be verified".

@varjolintu
Copy link
Copy Markdown
Member Author

I added one more thing to the PR. A default group can be specified, or the user can set an option that asks for the group every time when saving new credentials.

Screen Shot 2019-03-09 at 10 32 40

@varjolintu varjolintu force-pushed the feature/group_selection branch 2 times, most recently from 78b48c8 to 0c17791 Compare March 9, 2019 12:11
@droidmonkey
Copy link
Copy Markdown
Member

There is still a problem. When defining the group to save to, if it does not exist then the entry is silently dropped. The group should be created to store the new entry if it doesn't already exist. This will likely require changes on KeePassXC side.

@varjolintu
Copy link
Copy Markdown
Member Author

It also seems that triggering notifications from the popup doesn't work. Some changes are needed for that too. Probably we need to call the background script to activate them.

@varjolintu
Copy link
Copy Markdown
Member Author

@droidmonkey That is now done. KeePassXC side support is here: keepassxreboot/keepassxc#2790.

@droidmonkey
Copy link
Copy Markdown
Member

I thought of a little vulnerability with create entry/group. There is really nothing stopping abuse of the API to create an entry or group. We prevent retrieving information from the database by showing allow/deny dialog, but we do not prevent writing to the database (from KeePassXC).

@varjolintu
Copy link
Copy Markdown
Member Author

@droidmonkey Yes. We need to restrict this in some way.

@droidmonkey
Copy link
Copy Markdown
Member

We can introduce the protections in 2.4.1

@varjolintu varjolintu force-pushed the feature/group_selection branch from a9d5d33 to 34362ff Compare March 19, 2019 05:31
Copy link
Copy Markdown
Member

@droidmonkey droidmonkey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this functionality

@varjolintu varjolintu merged commit 72014b8 into develop Mar 23, 2019
@varjolintu varjolintu deleted the feature/group_selection branch March 23, 2019 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants