if bitwarden TOTP is not defined, do not pass totp as part of the credential to llm (#899)
This commit is contained in:
@@ -177,11 +177,13 @@ class BitwardenService:
|
|||||||
{
|
{
|
||||||
BitwardenConstants.USERNAME: item["login"]["username"],
|
BitwardenConstants.USERNAME: item["login"]["username"],
|
||||||
BitwardenConstants.PASSWORD: item["login"]["password"],
|
BitwardenConstants.PASSWORD: item["login"]["password"],
|
||||||
BitwardenConstants.TOTP: totp_code,
|
|
||||||
}
|
}
|
||||||
for item in items
|
for item in items
|
||||||
if "login" in item
|
if "login" in item
|
||||||
]
|
]
|
||||||
|
if totp_code:
|
||||||
|
for credential in credentials:
|
||||||
|
credential[BitwardenConstants.TOTP] = totp_code
|
||||||
|
|
||||||
if len(credentials) == 0:
|
if len(credentials) == 0:
|
||||||
return {}
|
return {}
|
||||||
|
|||||||
@@ -182,15 +182,16 @@ class WorkflowRunContext:
|
|||||||
# password secret
|
# password secret
|
||||||
password_secret_id = f"{random_secret_id}_password"
|
password_secret_id = f"{random_secret_id}_password"
|
||||||
self.secrets[password_secret_id] = secret_credentials[BitwardenConstants.PASSWORD]
|
self.secrets[password_secret_id] = secret_credentials[BitwardenConstants.PASSWORD]
|
||||||
|
|
||||||
totp_secret_id = f"{random_secret_id}_totp"
|
|
||||||
self.secrets[totp_secret_id] = BitwardenConstants.TOTP
|
|
||||||
|
|
||||||
self.values[parameter.key] = {
|
self.values[parameter.key] = {
|
||||||
"username": username_secret_id,
|
"username": username_secret_id,
|
||||||
"password": password_secret_id,
|
"password": password_secret_id,
|
||||||
"totp": totp_secret_id,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if BitwardenConstants.TOTP in secret_credentials and secret_credentials[BitwardenConstants.TOTP]:
|
||||||
|
totp_secret_id = f"{random_secret_id}_totp"
|
||||||
|
self.secrets[totp_secret_id] = BitwardenConstants.TOTP
|
||||||
|
self.values[parameter.key]["totp"] = totp_secret_id
|
||||||
|
|
||||||
except BitwardenBaseError as e:
|
except BitwardenBaseError as e:
|
||||||
LOG.error(f"Failed to get secret from Bitwarden. Error: {e}")
|
LOG.error(f"Failed to get secret from Bitwarden. Error: {e}")
|
||||||
raise e
|
raise e
|
||||||
|
|||||||
Reference in New Issue
Block a user