blacs30/bitwarden-alfred-workflow

Need to execute twice in order to copy password, TOTP to clipboard

Opened this issue · 4 comments

This has been occurring in the last 2 months where I go through the keystrokes to copy a password or TOTP to the clipboard and it doesn't actually get the information unless I execute it twice in a row.

Here is a video of it happening:

54a3195d-b078-4dce-908c-422eeaf5981e.mp4
  • Potentially I am trying to use the result to quickly and the script hasn't had time to execute and pull the password before I am trying to paste it.
  • I am using a self hosted vault-warden

Debugger Output

[09:22:05.023] Bitwarden v2[Script Filter] Passing output 'login.password' to Conditional
[09:22:05.024] Bitwarden v2[Conditional] Processing complete
[09:22:05.025] Bitwarden v2[Conditional] Passing output 'login.password' to Run Script
[09:22:06.305] STDERR: Bitwarden v2[Run Script] 🍺
09:22:05 workflow.go:328: -------- Bitwarden v2/3.0.4 (AwGo/0.27.1) --------
09:22:05 main.go:162: &main.options{Search:false, Config:false, SetConfigs:false, Auth:false, OnOffConfigs:false, AuthConfig:false, Lock:false, Icons:false, Folder:false, Unlock:false, Login:false, Logout:false, Sync:false, Open:false, GetItem:true, Force:false, Totp:false, Last:false, Background:false, Id:”<redacted>”, Query:"login.password", Attachment:"", Output:""}
09:22:05 main.go:164: args=[]string{"-getitem", "-id", "<redacted>", "login.password"} => []string{"login.password"}
09:22:05 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=25) "<redacted>",
 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=31) "<redacted>",
 Path: (string) (len=15) "/usr/local/bin/",
 ReorderingDisabled: (bool) true,
 Server: (string) (len=35) "<redacted-selfhoted vaultwarden>”,
 Sfa: (bool) true,
 SfaMode: (int) 0,
 SkipTypes: (string) "",
 TitleWithUser: (bool) true,
 TitleWithUrls: (bool) false,
 UseApikey: (bool) false,
 WebUiURL: (string) (len=35) "<redacted-selfhoted vaultwarden>"
}
09:22:05 bitwarden.go:239: Getting item for id <redacted>
09:22:05 bitwarden.go:242: Error making source key is:
error decrypting key, MAC doesn't match<redacted key 1>
09:22:05 bitwarden.go:279: MAC doesn't match <redacted key 2>
09:22:05 bitwarden.go:292: Falling back to Bitwarden CLI to get item.
09:22:06 bitwarden.go:328: Received jsonPath for item is login.password
09:22:06 bitwarden.go:345: Received key is: co*
09:22:06 workflow.go:405: ------------------ 1.264967458s ------------------
[09:22:06.315] Bitwarden v2[Run Script] Processing complete
[09:22:06.316] Bitwarden v2[Run Script] Passing output 'copyme' to Copy to Clipboard
[09:22:06.317] Bitwarden v2[Run Script] Passing output 'copyme' to Arg and Vars
[09:22:06.317] Bitwarden v2[Arg and Vars] Processing complete
[09:22:06.318] Bitwarden v2[Arg and Vars] Passing output 'Copy Password for user:
' to Post Notification

I have the same issue. It has been present since I started using the extension.

I always have to run the search process twice to successfully copy the password to the clipboard.

I don't know if it's relevant, but I notice that when I bring up the Alfred search window and run my search query, eg. bw some-website-login, holding the alt key displays a prompt in the Alfred search box that I can copy the username. However, holding the tab key displays no such prompt for copying the password.

You don't need to copy it twice, it just takes 3 seconds.. If you count to 3 before pasting it works (Annoying). I guess something really slows it down before it is send to clipboard.

@griffinsteffy19 maybe check if this is the case for you too and adjust your issue.

It's slow because underneath it's using the Bitwarden cli (again) to decrypt/get the secrets.

Thats what I thought.

I see two solutions for solving atleast part of the frustration:

  1. lock the UI until TOTP is done copying by
    a. waiting on bw cli until it is done copying or
    b. implementing a timer that counts down to the average time that it takes to decrypt and load a TOTP to clipboard
  2. show beside 'Copy TOTP' in the UI (when you press control on a item) that it takes +/- 5 seconds to be loaded in to clipboard. for ex.:
    Copy TOTP (Takes +/- 5s to load)