bitwarden-alfred-workflow icon indicating copy to clipboard operation
bitwarden-alfred-workflow copied to clipboard

Missing permission to copy LaunchAgent

Open torbenkeller opened this issue 1 year ago • 9 comments

when I want to execute the install auto sync script I always get the following output:

[23:32:31.717] Bitwarden v2[List Filter] Processing complete
[23:32:31.728] Bitwarden v2[List Filter] Passing output '--install' to Run Script
[23:32:31.922] ERROR: Bitwarden v2[Run Script] found workflow v3.0.1 at /Users/torben/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.DA388574-13BA-4CE9-9B0C-D96C84AE7AC0
cp: /Users/torben/Library/LaunchAgents/com.lisowski-development.alfred.bitwarden_autosync.plist: No such file or directory
[23:32:31.939] Bitwarden v2[Run Script] Processing complete
[23:32:31.947] Bitwarden v2[Run Script] Passing output 'removing existing service
generating new service configuration
generated config with 2 timers [at 8:15 23:45 ]
/var/folders/l1/vq850vsj4cz36sh0wh_24kqr0000gn/T//com.lisowski-development.alfred.bitwarden_autosync.plist: OK
result|1|failed to copy LaunchAgent
' to Run Script
[23:32:31.993] Bitwarden v2[Run Script] Processing complete
[23:32:32.005] Bitwarden v2[Run Script] Passing output 'result|1|failed to copy LaunchAgent
' to Split Arg
[23:32:32.011] Bitwarden v2[Split Arg] Processing complete
[23:32:32.017] Bitwarden v2[Split Arg] Passing output 'result|1|failed to copy LaunchAgent
' to Conditional
[23:32:32.022] Bitwarden v2[Conditional] Processing complete
[23:32:32.026] Bitwarden v2[Conditional] Passing output 'result|1|failed to copy LaunchAgent
' to Arg and Vars
[23:32:32.031] Bitwarden v2[Arg and Vars] Processing complete
[23:32:32.035] Bitwarden v2[Arg and Vars] Passing output 'result|1|failed to copy LaunchAgent
' to Post Notification

seems like the permission to copy the created plist file into the LaunchAgent folder is missing:

if ! /bin/cp -f "${plist_tmp_path}" "${plist_path}"; then _end 1 "failed to copy LaunchAgent"; fi

torbenkeller avatar Sep 06 '23 21:09 torbenkeller

I looked into this a bit since I'm the original author of that portion of the workflow. Seems it's in need of some dusting off!

I've just posted updated versions of the bw_cache_update.sh and bw_auto_lock.sh scripts that are used for the LaunchAgents controlling autosync/autolock. Can you try downloading them:

  • https://github.com/luckman212/bw-cache-update/blob/2023/bw_cache_update.sh
  • https://github.com/luckman212/bw-cache-update/blob/2023/bw_auto_lock.sh
image

...and dropping them into your workflow's folder, replacing the existing ones and give it another try?

Another thing to double check is that you've granted Full Disk Access and Accessibility permissions to Alfred:

screenshot_1YI2GXZi

screenshot_0jXiBYXg

luckman212 avatar Sep 07 '23 01:09 luckman212

@blacs30

While we wait for @torbenkeller to test, I've submitted these changes as PR https://github.com/blacs30/bitwarden-alfred-workflow/pull/176

luckman212 avatar Sep 07 '23 18:09 luckman212

Thank you @luckman212 for your fast response!

I replaced the files you mentioned in the workflow and still get the error. But now I also get a dialog window telling me the task has failed.

Screenshot 2023-09-07 at 21 47 45

The new log message is this:

[21:46:34.021] Bitwarden v2[List Filter] Processing complete
[21:46:34.027] Bitwarden v2[List Filter] Passing output '--install' to Run Script
[21:46:34.029] ERROR: Bitwarden v2[Run Script] Task '/Users/torben/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.DA388574-13BA-4CE9-9B0C-D96C84AE7AC0/bw_auto_lock.sh' failed with reason 'launch path not accessible'
[21:46:34.030] Bitwarden v2[Run Script] Processing complete
[21:46:34.032] Bitwarden v2[Run Script] Passing output '' to Run Script
[21:46:34.053] Bitwarden v2[Run Script] Processing complete
[21:46:34.067] Bitwarden v2[Run Script] Passing output '' to Split Arg
[21:46:34.069] Bitwarden v2[Split Arg] Processing complete
[21:46:34.070] Bitwarden v2[Split Arg] Passing output '' to Conditional

I hope this helps!

torbenkeller avatar Sep 07 '23 19:09 torbenkeller

The workflow should be automatically making those scripts +x executable, but I'll need to check on that.

For now, try opening a Terminal and pasting

cd '/Users/torben/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.DA388574-13BA-4CE9-9B0C-D96C84AE7AC0'
chmod +x *.sh

luckman212 avatar Sep 07 '23 20:09 luckman212

I just pushed another update to #176 with an auto-fix for the +x flag. If that gets merged it could help with this

luckman212 avatar Sep 08 '23 14:09 luckman212

Feel free to merge and tag. I think @luckman212 might be also able to release a new version. - After a new tag is pushed a draft release is created and it just needs to be released. I'm currently unable for the next 2 weeks to do it myself.

blacs30 avatar Sep 09 '23 21:09 blacs30

@blacs30 I am happy to help, but I'm a bit uneasy about pushing a new release before reviewing the steps with you, becauce I think it involves compiling the bitwarden-alfred-workflow binary as well? This isn't urgent, let's check back on it in a couple of weeks. I merged #176 in the meantime.

luckman212 avatar Sep 10 '23 03:09 luckman212

I just opened https://github.com/blacs30/bitwarden-alfred-workflow/pull/179 because the new bw_auto_lock.sh didn't work for me any more, I think there was a typo in a variable name.

wollew avatar Nov 01 '23 10:11 wollew

Thanks @wollew you're right. It wasn't technically a typo, but rather a missed instance of that bwexec variable which got renamed somewhere along the way. Good catch and sorry for the trouble.

luckman212 avatar Nov 01 '23 11:11 luckman212