Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: lock vault after a (configurable) timeout #64

Closed
wollew opened this issue Jan 12, 2021 · 8 comments · Fixed by #82
Closed

Feature request: lock vault after a (configurable) timeout #64

wollew opened this issue Jan 12, 2021 · 8 comments · Fixed by #82
Labels
bug Something isn't working enhancement New feature or request

Comments

@wollew
Copy link

wollew commented Jan 12, 2021

Hi, would it be possible to lock the bitwarden vault after a configurable timeout. I do not really like the token being in memory basically forever, at least if I don't lock on demand.

@blacs30 blacs30 added the enhancement New feature or request label Jan 12, 2021
@wollew
Copy link
Author

wollew commented Jan 20, 2021

So, I solved this by using Hammerspoon to trigger this workflow's lock code as soon as the screen is locked, works perfectly well for me, even better than a fixed timeout.
BTW, in order to do this I dug into the code a little bit further and realized the token is actually stored in the Keychain, nice!

@blacs30
Copy link
Owner

blacs30 commented Jan 20, 2021

Thanks a lot for your feedback @wollew
Would you mind sharing the lua script you wrote so we all could benefit from this?
I could use it as a current workaround. Currently I wouldn't know exactly how to achieve the lock - possibly via LaunchAgent to trigger the workflow binary to lock Bitwarden.

@wollew
Copy link
Author

wollew commented Jan 20, 2021

Sure. I created a new Spoon, until I manage to clean it up and create a merge request, you'll find it here:
https://github.com/wollew/Spoons/blob/master/Source/OnLockUnlock.spoon

My hammerspoon init.lua contains this code:

hs.loadSpoon("OnLockUnlock")
spoon.OnLockUnlock.OnLockAppleScript = 'tell application id "com.runningwithcrayons.Alfred" to run trigger "auth" in workflow "com.lisowski-development.alfred.bitwarden" with argument "-lock"'
spoon.OnLockUnlock:start()

EDIT: I also had to add the "Inbound Configuration" named "auth" to the bash script running ./bitwarden-alfred-workflow in this workflow for this to work. Now that I know the token's stored in the keychain, I could probably just delete it directly via Applescript instead of going through the workflow.

@steveoh
Copy link

steveoh commented Feb 23, 2021

last pass had this setting in the fork, can we crib the code from there? At a minimum the log out when the machine restarts.

@blacs30
Copy link
Owner

blacs30 commented Feb 23, 2021

Yes I have it definitely planned. It's a very valid point.
I think I might first look at a way to use the local LaunchAgent for this.

@blacs30
Copy link
Owner

blacs30 commented Jun 7, 2021

This features got implemented by version 2.3.0 please feel free to reopen this issue in case of problems with it

@blacs30 blacs30 closed this as completed Jun 7, 2021
@wollew
Copy link
Author

wollew commented Jun 15, 2021

Thank you for implementing this feature, I just tried it but it did not work for me OOTB. After doing some debugging I think the problem is in bw_auto_lock.sh which assumes there is a binary named bitwarden-alfred-workflow although my workflow directory only has bitwarden-alfred-workflow-arm64 and bitwarden-alfred-workflow-amd64. I created a symlink to (in my case) the amd64 version, after that everything works fine.

(I cannot reopen this issue because github doesn't allow this if a repo owner closes an issue).

@blacs30
Copy link
Owner

blacs30 commented Jun 15, 2021

Thank you @wollew I noticed the same but didn't have time to debug (I tested before with the old version I guess which didn't have separate binaries). This explains the error 127 which launchctl did report.
It is also affecting the auto update.
I will soon fix that.

@blacs30 blacs30 reopened this Jun 15, 2021
@blacs30 blacs30 added the bug Something isn't working label Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants