From 111d1e3a8e4bac3d2afda5d6a9b48d6b1ff44a0a Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Mon, 13 Jan 2025 22:28:30 -0800 Subject: [PATCH] Bitwarden updates (#1547) --- skyvern/forge/sdk/services/bitwarden.py | 11 +++++++++-- skyvern/forge/sdk/workflow/service.py | 4 ---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/skyvern/forge/sdk/services/bitwarden.py b/skyvern/forge/sdk/services/bitwarden.py index bf4fd4e6..5924e780 100644 --- a/skyvern/forge/sdk/services/bitwarden.py +++ b/skyvern/forge/sdk/services/bitwarden.py @@ -358,6 +358,9 @@ class BitwardenService: BitwardenService.sync() session_key = BitwardenService.unlock(master_password) + if not bw_organization_id and not collection_id: + raise BitwardenAccessDeniedError() + # Step 3: Retrieve the items list_command = [ "bw", @@ -513,6 +516,12 @@ class BitwardenService: "--session", session_key, ] + + # Bitwarden CLI doesn't support filtering by organization ID or collection ID for credit card data so we just raise an error if no collection ID or organization ID is provided + if not bw_organization_id and not collection_id: + LOG.error("No collection ID or organization ID provided -- this is required") + raise BitwardenAccessDeniedError() + item_result = BitwardenService.run_command(get_command) # Parse the item and extract credit card data @@ -571,8 +580,6 @@ class BitwardenService: """ Get the credit card data from the Bitwarden CLI. """ - if not bw_organization_id and not bw_collection_ids: - raise BitwardenAccessDeniedError() try: async with asyncio.timeout(settings.BITWARDEN_TIMEOUT_SECONDS): return await BitwardenService._get_credit_card_data( diff --git a/skyvern/forge/sdk/workflow/service.py b/skyvern/forge/sdk/workflow/service.py index 35fd7d90..8cf160f7 100644 --- a/skyvern/forge/sdk/workflow/service.py +++ b/skyvern/forge/sdk/workflow/service.py @@ -1218,10 +1218,6 @@ class WorkflowService: description=parameter.description, ) elif parameter.parameter_type == ParameterType.BITWARDEN_CREDIT_CARD_DATA: - if not organization.bw_organization_id and not organization.bw_collection_ids: - raise InvalidWorkflowDefinition( - message="To use credit card data parameters, please contact us at support@skyvern.com" - ) parameters[parameter.key] = await self.create_bitwarden_credit_card_data_parameter( workflow_id=workflow.workflow_id, bitwarden_client_id_aws_secret_key=parameter.bitwarden_client_id_aws_secret_key,