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

Not able to unlock session #84

Open vargn opened 9 months ago

vargn commented 9 months ago

Since the latest bitwarden-cli 2023.12.0-1 Arch package, I have not been able to unlock my BW session using my master password. Downgrading to bitwarden-cli 2023.10.0-1 resolved the issue.

oleasteo commented 7 months ago

The issue seems to be that the newer bitwarden-cli for some reason now outputs

mac failed.
SOME_HASH

instead of just the hash during unlock, as expected by bitwarden-rofi.

Temporary workaround: Add | grep -vF 'mac failed.' after bw --raw --nointeraction unlock "$mpw" 2>&1 (line 58 in /usr/bin/bwmenu, arch linux). It should look like this:

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 | grep -vF 'mac failed.')"; then
    exit_error 1 "Could not unlock vault: $out"
  fi
  echo "$out"
}
vargn commented 7 months ago

The issue seems to be that the newer bitwarden-cli for some reason now outputs

mac failed.
SOME_HASH

instead of just the hash during unlock, as expected by bitwarden-rofi.

Temporary workaround: Add | grep -vF 'mac failed.' after bw --raw --nointeraction unlock "$mpw" 2>&1 (line 58 in /usr/bin/bwmenu, arch linux). It should look like this:

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 | grep -vF 'mac failed.')"; then
    exit_error 1 "Could not unlock vault: $out"
  fi
  echo "$out"
}

Can confirm this is working. Thank you!

andyhunne commented 6 months ago

The issue seems to be that the newer bitwarden-cli for some reason now outputs

mac failed.
SOME_HASH

instead of just the hash during unlock, as expected by bitwarden-rofi.

Temporary workaround: Add | grep -vF 'mac failed.' after bw --raw --nointeraction unlock "$mpw" 2>&1 (line 58 in /usr/bin/bwmenu, arch linux). It should look like this:

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 | grep -vF 'mac failed.')"; then
    exit_error 1 "Could not unlock vault: $out"
  fi
  echo "$out"
}

Sorted me out too. Thanks for this!