mattydebie / bitwarden-rofi

Wrapper for Bitwarden https://github.com/bitwarden/cli and Rofi
GNU General Public License v3.0
346 stars 56 forks source link

Could not load items - mac failed #83

Open visibilityspots opened 10 months ago

visibilityspots commented 10 months ago

I used the bwmenu for a few weeks now all went fine and I was quite happy. But last couple of days it failed on me, I was asked for my Master Password and only got the message in rofi stating

Could not load items

after some research I tried the keyctl commands but without success. So I digged a little deeper and started looking into the code. I came to the conclusion the ask_password function was giving me a session hash with the error message 'mac failed' included.

This seemed to be the culprit since obviously that wasn't a valid session hash, as I understood this has something to see with some corrupt entries in my vaultwarden, although I don't see any errors in the vaultwarden server neither in the CLI commands I use or the mobile app nor the firefox plugin.

As a workaround I changed the unlock command to redirect it's stderr to /dev/null which now circumvents the issue.

ask_password() {                                                                                         
  rm $CACHE_FILE
  mpw=$(printf '' | rofi -dmenu -p "Master Password" -password -l 0 ${ROFI_OPTIONS[@]}) || exit $?
  if ! out="$(bw --raw --nointeraction unlock "$mpw" 2>/dev/null)"; then
    exit_error 1 "Could not unlock vault: $out"
  fi
  echo "$out"
}
ask_password() {
  rm $CACHE_FILE
  mpw=$(printf '' | rofi -dmenu -p "Master Password" -password -l 0 ${ROFI_OPTIONS[@]}) || exit $?
  if ! out="$(bw --raw --nointeraction unlock "$mpw" 2>&1)"; then
    exit_error 1 "Could not unlock vault: $out"
  fi
  echo "$out"
}

yet I'm wondering if we should tackle this in the ask_password function to only fetch the session hash and if by any chance someone could point me in the direction how to fix the mac failed issue in the first place?

arch-dawson commented 10 months ago

I started getting the same issue a few days ago

MaxWinsemius commented 6 months ago

I have a similar issue on archlinux - updated yesterday. I fixed it by redirecting the stderr from the rm command failing into /dev/null in /usr/bin/bwmenu

 ask_password() { 
-  rm $CACHE_FILE
+  rm $CACHE_FILE 2>/dev/null 
   mpw=$(printf '' | rofi -dmenu -p "Master Password" -password -l 0 ${ROFI_OPTIONS[@]}) || exit $? 
   if ! out="$(bw --raw --nointeraction unlock "$mpw" 2>&1)"; then 
     exit_error 1 "Could not unlock vault: $out" 
   fi 
   echo "$out" 
 }