bitwarden-rofi icon indicating copy to clipboard operation
bitwarden-rofi copied to clipboard

Add caching of items to reduce loading time

Open moukle opened this issue 3 years ago • 5 comments

Adresses issue #51: went from ~1.09s to ~0.31s for me.

Some comments:

  • write ITEMS to caching file (/tmp/bwmenu/logins.gpg)
  • file is encrypted using gpg default algorithm (AES256, which is used by BW)
    • could change with --cipher algo (see available options with gpg --version
    • passphrase is the BW_HASH, since having the session key would also grant access to the vault of bw (?)

moukle avatar Dec 19 '20 23:12 moukle

This is looking good! I have one question however, why did you decide to move the cache file from ~/.cache to /tmp?

mattydebie avatar Jan 07 '21 07:01 mattydebie

Glad you like!

I moved to /tmp/ in order to make the encrypted logins more temporary. Once you logout of bwmenu, the BW_HASH is unusable for bwmenu itself. But with access to the logins.gpg would still yield great danger. This is not solved, by moving to /tmp but a little better. Ideally the logins.gpg should be safely shred after logout?

I'm not sure if this is really an issue. If an attacker has access to the BW_HASH, he prolly has already serious control.


Edit: My first approach was to only store the item names without the passwords. Then I would load the item names and load_items() & in subshell. However I didn't find a satisfying solution to access the items again in the original shell, without some FIFO or such. Thus I opted for the login.gpg. It could be solved with more powerful threading options, which bash doesn't offer I think.

moukle avatar Jan 07 '21 16:01 moukle

Is there anything preventing you from merging this? I tested it out and the improvement in loading times is great :)

jakobkukla avatar Mar 24 '21 19:03 jakobkukla

Sorry, did some Git wobbling :grin:

moukle avatar Apr 16 '21 17:04 moukle

Bump

AlecsFerra avatar Sep 05 '21 17:09 AlecsFerra

Thanks again! This is an awesome improvement to the speed. merge in 61a9e68

mattydebie avatar Apr 14 '23 08:04 mattydebie