-
Notifications
You must be signed in to change notification settings - Fork 44
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
Invalidation of sessions to due frequency of calls #23
Comments
The first issue can be easily fixed by using diff --git a/ansible/lookup_plugins/bitwarden.py b/ansible/lookup_plugins/bitwarden.py
index 48c3c1f..e78aa63 100755
--- a/ansible/lookup_plugins/bitwarden.py
+++ b/ansible/lookup_plugins/bitwarden.py
@@ -19,6 +19,7 @@ import json
import os
import sys
+from shutil import which
from subprocess import Popen, PIPE, STDOUT, check_output
from ansible.errors import AnsibleError
@@ -70,9 +71,7 @@ class Bitwarden(object):
def __init__(self, path):
self._cli_path = path
self._bw_session = ""
- try:
- check_output([self._cli_path, "--version"])
- except OSError:
+ if which("bw") is None:
raise AnsibleError("Command not found: {0}".format(self._cli_path))
@property Which gets rid of the first batch of pointless mass |
If we look at BitWarden CLI source we can see how checking status works: private async status(): Promise<string> {
const authed = await this.stateService.getIsAuthenticated();
if (!authed) {
return "unauthenticated";
}
const isLocked = await this.vaultTimeoutService.isLocked();
return isLocked ? "locked" : "unlocked";
} https://github.com/bitwarden/cli/blob/2ae2fdfd/src/commands/status.command.ts#L44-L52 Which calls their async getIsAuthenticated(options?: StorageOptions): Promise<boolean> {
return (await this.getAccessToken(options)) != null && (await this.getUserId(options)) != null;
} https://github.com/bitwarden/jslib/blob/2ae2fdfd/common/src/services/state.service.ts#L1519-L1521 So it tries to get an access token from the API and check user ID to verify state of session. |
The thing is, I don't see a reason to check What's the point of the |
For more details see: - status-im/infra-misc#90 - c0sco/ansible-modules-bitwarden#23 Signed-off-by: Jakub Sokołowski <[email protected]>
For more details see: - status-im/infra-misc#90 - c0sco/ansible-modules-bitwarden#23 Signed-off-by: Jakub Sokołowski <[email protected]>
I've been using this plugin for a while and I appreciate it being freely available. I've been seeing issues with sessions invalidating.
Specifically it happens when I run multiple playbooks on big numbers of hosts, which causes the API to hit some kind of rate llimit:
This becomes quite an issue when trying to make big changes rapidly.
The text was updated successfully, but these errors were encountered: