blacs30 / bitwarden-alfred-workflow

Simple Bitwarden Workflow for Alfred
MIT License
448 stars 31 forks source link

Unexpected "Invalid master password" error #141

Closed edoardob90 closed 2 years ago

edoardob90 commented 2 years ago

Hello! Firstly, thanks for the efforts in building this workflow.

Unfortunately, it doesn't work for me when using the latest version of both the workflow (2.4.6) and Bitwarden CLI (2022.10.0). And the error "Invalid master password" is clearly hiding something more subtle since the master password is correct.

What I tried so far:

  1. Logging with the password and API key (neither works)
  2. Logging out from CLI with bw logout (from the CLI, I can log in and then unlock without problems)
  3. Logging out/in from the workflow's auth settings
  4. Deleting the workflow's cache and the data.json file located in ~/Library/Application Support

The log in Alfred debugger isn't that useful since it reports only the "Invalid master password" error. Here it's, just in case:

[16:44:55.520] ERROR: Bitwarden v2[Run Script] 🍺
16:44:45 workflow.go:328: -------- Bitwarden v2/2.4.6 (AwGo/0.27.1) --------
16:44:45 main.go:162: &main.options{Search:false, Config:false, SetConfigs:false, Auth:false, OnOffConfigs:false, AuthConfig:false, Lock:false, Icons:false, Folder:false, Unlock:true, Login:false, Logout:false, Sync:false, Open:false, GetItem:false, Force:false, Totp:false, Last:false, Background:false, Id:"", Query:"", Attachment:"", Output:""}
16:44:45 main.go:164: args=[]string{"-unlock"} => []string{}
16:44:45 main.go:165: (main.config) {
 AutoFetchIconCacheAge: (int) 1440,
 AutoFetchIconMaxCacheAge: (time.Duration) 24h0m0s,
 BwconfKeyword: (string) (len=9) ".bwconfig",
 BwauthKeyword: (string) (len=7) ".bwauth",
 BwKeyword: (string) (len=3) ".bw",
 BwfKeyword: (string) (len=4) ".bwf",
 BwExec: (string) (len=2) "bw",
 BwDataPath: (string) "",
 Debug: (bool) false,
 Email: (string) (len=19) "xxx@yyyy.zz",
 EmailMaxWait: (int) 15,
 EmptyDetailResults: (bool) false,
 IconCacheAge: (int) 43200,
 IconCacheEnabled: (bool) true,
 IconMaxCacheAge: (time.Duration) 720h0m0s,
 MaxResults: (int) 1000,
 Mod1: (string) (len=3) "alt",
 Mod1Action: (string) (len=13) "username,code",
 Mod2: (string) (len=5) "shift",
 Mod2Action: (string) (len=3) "url",
 Mod3: (string) (len=4) "ctrl",
 Mod3Action: (string) (len=4) "totp",
 Mod4: (string) (len=7) "cmd,opt",
 Mod4Action: (string) (len=4) "more",
 Mod5: (string) (len=9) "cmd,shift",
 Mod5Action: (string) (len=5) "webui",
 NoModAction: (string) (len=13) "password,card",
 OpenLoginUrl: (bool) true,
 OutputFolder: (string) (len=25) "/Users/edoardo/Downloads/",
 Path: (string) (len=83) "/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin:/usr/bin:/usr/sbin",
 ReorderingDisabled: (bool) true,
 Server: (string) "",
 Sfa: (bool) true,
 SfaMode: (int) 0,
 SkipTypes: (string) "",
 TitleWithUser: (bool) true,
 TitleWithUrls: (bool) false,
 UseApikey: (bool) true,
 WebUiURL: (string) (len=27) "https://vault.bitwarden.com"
}
16:44:51 bitwarden.go:398: [DEBUG] ==> first few chars of the password is  xxx
16:44:55 utils.go:32: [ERROR] ==>  [Invalid master password.]
16:44:55 utils.go:44: [ERROR] ==> Exit code 1. Unlocking Bitwarden failed. Err: Invalid master password.
16:44:55 workflow.go:376: [ERROR] Unlocking Bitwarden failed. Error:
Invalid master password.
16:44:55 workflow.go:379: Get help at https://github.com/blacs30/bitwarden-alfred-workflow/issues
16:44:55 workflow.go:402: ------------------ 9.953131495s ------------------
[16:44:55.523] Bitwarden v2[Run Script] Processing complete
[16:44:55.530] Bitwarden v2[Run Script] Passing output 'Unlocking Bitwarden failed. Error:
Invalid master password.' to Post Notification

I'm not proficient in Go, hence it seemed a waste of time to dig into the source code and try to understand its inner working. But if there's any other info I can provide to help debugging, please let me know.

And thanks in advance for any hints!

zichichi commented 2 years ago

same problem. Authentication with api works on cli, but if I try from alfred it gives me incorrect password

blacs30 commented 2 years ago

Did it work before? Could you try with version 2.4.4 - in version 2.4.5 the input for the master password changed. Are there many special chars or any leading/trailing spaces in the password?

zichichi commented 2 years ago

Did it work before? Could you try with version 2.4.4 - in version 2.4.5 the input for the master password changed. Are there many special chars or any leading/trailing spaces in the password?

on version 2.4.4 it works

blacs30 commented 2 years ago

I was able to recreate the issue with trailing or leading spaces for the master password.

blacs30 commented 2 years ago

Just released version 2.4.7 which should fix that issue.