keepassxreboot / keepassxc

KeePassXC is a cross-platform community-driven port of the Windows application “Keepass Password Safe”.
https://keepassxc.org/
Other
21.5k stars 1.48k forks source link

Enable "group" field to be searched #3482

Closed dssouza-ti closed 4 years ago

dssouza-ti commented 5 years ago

Summary

I would like to find all entries in a group by searching for the groups name.

Desired Behavior

Let's say I have my database organized in the following way:

groups -> subgroups -> entries: image

If I search for "subgroup1", I want the search results to bring me all entries within all groups named subgroup1: image

If I search for "client2 subgroup3", I want only the entries in subgroup3 of group client2 to be shown as a result: image

Current Behavior

Today it's not possible to search for group names, since the group field is not enabled in the search feature: image

Search help: image

Possible Solution

Enable the group field in the search feature

Context

I'm an I.T. service provider with several clients. I have a database with more than 80 groups named after the clients and all of them have the same subgroups, which are named after equipment categories, for example: group "Client1" -> subgroups "Storage", "Firewall", "VPN".

Inside the subgroups, the entries names always are different, because my clients use different equipments, so client 1 firewall will be a Sonicwall, while client 2 firewall will be a Fortigate, and so on.

It's very common that I need to search for entries in a "firewall" group within a specific "client" group, or search for all entries in every "storage" group within all "client" groups, and I can't do that now because the "group" field is not enabled to be searched. I did that a lot when I was using mono implementation of keepass, but I find keepassxc way better in several aspects, so I'm using it anyway, but it's really a bummer not being able to perform a search like this.

droidmonkey commented 5 years ago

I'm not sure what the point is (besides combining entries from similarly named disparate groups). You can enable "group scoped" search by clicking the search icon to the left of the bar. With that, just select the group you want to search in and do your search.

What I'm trying to say is the groups are already binning the entries.

dssouza-ti commented 5 years ago

I understand what you're saying, but my issue is exactly the name of the entries. I believe I wasn't clear enough when I said the entry names are different. They are VERY different within the same categories, and with the amount of clients I have, It's really difficult to remember exactly what to search for. With that in mind, being able to search for the group name is super useful and super practical, since I just have to press CTRL+F, type the group name and look at the entries being shown.

The reason for the names to be so different is that there are innumerous types of firewall or storage or VPN equipments with different vendors, models and so on (Imagine something like cars. There are so many information about cars, like car model, maker, year, engine... that is actualy really hard to remember what are exactly the cars of 100 clients and with the different informations it's hard to even remember what to search for). Also, my entire team creates entries in this database for every new equipment we have to access and since we were using the search feature in mono keepass, we didn't need to stablish a pattern to create entry names. Even if I wanted to change the entry names to something more search friendly now, it's currently impractical to do so because of the size our database is.

Also "combining entries from similarly named disparate groups" is actually great for our use case. :)

If this is a too specific of a use case, let me konw and I'll try to work around this issue, but I believe this could help a lot of people just for making keepassxc even more practical to use.

Thanks a lot for your attention.

droidmonkey commented 5 years ago

I am definitely ok with adding a group field to search such as: group:name1 or simply g:name1. Search used to include group names by design but it didn't make sense to do this as searching returned results that had nothing to do with the desired search query (which is normally for a specific entry ).

dssouza-ti commented 5 years ago

I am definitely ok with adding a group field to search such as: group:name1 or simply g:name1.

That would be awesome. Thanks. :)

Search used to include group names by design but it didn't make sense to do this as searching returned results that had nothing to do with the desired search query (which is normally for a specific entry ).

I see your point, it's just a different use case. :)

tomhundt commented 5 years ago

You can enable "group scoped" search by clicking the search icon to the left of the bar. With that, just select the group you want to search in and do your search.

Ha, yet another feature I never knew existed, thank you for pointing it out :-)

I'm using the Mac version (2.4.3) and it only drops down the menu if I click on the rightmost third of the binocular/gear search icon. (I'll test this some more and log it separately.)

Search used to include group names by design but it didn't make sense to do this as searching returned results that had nothing to do with the desired search query (which is normally for a specific entry ).

Ah, I found this issue because I was just about to suggest searches should include groups, and moreover, that it should include the notes for the groups. I have, for example, a "Computers" group and the Notes for it says "Local laptops/desktops/computers/PCs/servers/machines" which are all keywords I'd like to be able to search for.

So in the OP's use case, he would be able to type "g:acme firewall" and get the "Firewall" entry in the "Acme Corp" group. Or in my case I could type "g:laptop jane" and get any entry with "jane" that's in my Computers group.

An alternative implementation would be to have an Application Setting like "Include groups in searches" which would try to match all the search terms to Groups also.

danoe commented 5 years ago

It would be really nice to have the group included in searches. Same use-case as @dssouza-ti basically, every group is a server name here, with the actual entries being for services, like SSH, HTTP, MySQL etc. In my case the server name is not referenced anywhere on the actual item, the URL field is set with the IP address in most cases or just empty.

droidmonkey commented 5 years ago

The group name is listed on the far left of search results. You can sort by group name in the results. Until the group search field is added.

danoe commented 5 years ago

I saw that, thanks, and just tested, typing a letter makes it jump to that letter too, which is nice. Though, after opening a group, I have to switch back to the top folder and search * again.

johanfleury commented 5 years ago

Search used to include group names by design but it didn't make sense to do this as searching returned results that had nothing to do with the desired search query (which is normally for a specific entry ).

Just to add some more to this conversation, I used to search by group name because I have group named after some servers.

So, for instance, I used to search for foobar2000, get to the "root" entry and copy the password. Now I need to go to the group, and look for the root entry, search bar has no interest in this case anymore.

HoffmannP commented 5 years ago

+1 for group search, same as johanfleury. We have a bunch of servers all containing MySQL root and SSH root. So just searching for title:mysql user:root still gives me to many. group could als use the [$groupname] > [$subgroup] … syntax you see at the bottom when a group is selected

smoebody commented 4 years ago

I just want to mention that keepass-search includes groups as well and it would make migration much easier. As mentioned by a lot of people before, we also have a group per server (whether this is clever or not) and searching for it is currently not possible.

Thanks to @droidmonkey for addressing this.

However i want suggest not to have the term prefixed by g: or group: since one has to be aware that it is searching a group. Instead i would appreciate a setting like "include groups in search" as @tomhundt suggested.

tomhundt commented 4 years ago

As a workaround if one is really desperate for searching by groups, one could use the command-line version of the program, and just keep it running in a window:

$ cd /Applications/KeePassXC.app/Contents/MacOS
$ keepassxc-cli open ~/mydb.kdbx
mydb> ls -Rf 
TEST/
TEST/H TEST
TEST/TEST - Clone
TEST/TEST1
TEST/TEST2
TEST/TEST2 - Clone
mydb> ls TEST
H TEST
TEST - Clone
TEST1
TEST2
TEST2 - Clone
mydb> show TEST/TEST1
Title: TEST1
UserName: just.a.spacer
Password: PROTECTED
URL:
Notes:
mydb> show -s TEST/TEST2
Title: TEST2
UserName: joe.user
Password: something🤣else
URL: http://test2.foo/
Notes:          (__)
         (oo)
  /-------\/
 / |     ||
*  ||----||
   ^^    ^^

Example table (lines up correctly in fixed width)
ID      USER    STATUS
123     foo     Failure
400     bar     Awesome
mydb> ^DSegmentation fault: 11

Here, TEST is the name of the group (sorry, lame example) and the things next to it (TEST2 - Clone) are entries. It asks for the password when you open the db. You have to use -s to get show to display the PROTECTED items, i.e., the password. You should really use the close command and not hit ^D.

This is not great security. Make sure you lock your computer when you go for a coffee ;-)

smoebody commented 4 years ago

@tomhundt I am not sure whether this is working, at least your example is proving nothing. Since TEST is also included in the item names it could be that the search only finds by items.

Try to add new item in group TEST with a name like foobar and see whether it appears when searching for TEST.

ghost commented 4 years ago

In https://github.com/keepassxreboot/keepassxc/blob/develop/src/core/EntrySearcher.cpp#L145 does a simple case with something like this entry->group()->database()->rootGroup()->print(true, false) sound right? Or is it a more complicated problem?

ghost commented 4 years ago

Please help the maintainers to merge #4705 to get this feature (finally) fixed :smiley: