From fdea47612553cc21c41c4d6c70466c9bfae3c6b9 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Wed, 10 Jul 2024 06:44:22 +0000 Subject: [PATCH 1/2] fix: requirements.txt to reduce vulnerabilities The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-ZIPP-7430899 --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 4e3ca86..df433bc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,4 @@ python-dotenv flit black urllib3==2.2.2 # not directly required, pinned by Snyk to avoid a vulnerability +zipp>=3.19.1 # not directly required, pinned by Snyk to avoid a vulnerability From 09469bc4b2604abf540b195c5673c0c7e4181522 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Wed, 10 Jul 2024 06:44:40 +0000 Subject: [PATCH 2/2] Fix code style issues with Black --- conftest.py | 2 +- delinea/secrets/server.py | 25 ++++++++++++++++++------- tests/test_server.py | 1 + 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/conftest.py b/conftest.py index 445aa8a..90fc0b7 100644 --- a/conftest.py +++ b/conftest.py @@ -15,7 +15,7 @@ def env_vars(): "secret_id": os.getenv("TSS_SECRET_ID"), "secret_path": os.getenv("TSS_SECRET_PATH"), "folder_id": os.getenv("TSS_FOLDER_ID"), - "folder_path": os.getenv("TSS_FOLDER_PATH") + "folder_path": os.getenv("TSS_FOLDER_PATH"), } diff --git a/delinea/secrets/server.py b/delinea/secrets/server.py index 7c4d5db..29e3a0d 100644 --- a/delinea/secrets/server.py +++ b/delinea/secrets/server.py @@ -352,14 +352,17 @@ def get_secret_json(self, id, query_params=None): endpoint_url = f"{self.api_url}/secrets/{id}" if query_params is None: - return self.process(requests.get(endpoint_url, headers=self.headers(), timeout=60)).text + return self.process( + requests.get(endpoint_url, headers=self.headers(), timeout=60) + ).text else: return self.process( requests.get( endpoint_url, params=query_params, headers=self.headers(), - timeout=60) + timeout=60, + ) ).text def get_folder_json(self, id, query_params=None, get_all_children=True): @@ -424,7 +427,9 @@ def get_secret(self, id, fetch_file_attachments=True, query_params=None): endpoint_url = f"{self.api_url}/secrets/{id}/fields/{item['slug']}" if query_params is None: item["itemValue"] = self.process( - requests.get(endpoint_url, headers=self.headers(), timeout=60) + requests.get( + endpoint_url, headers=self.headers(), timeout=60 + ) ) else: item["itemValue"] = self.process( @@ -432,7 +437,8 @@ def get_secret(self, id, fetch_file_attachments=True, query_params=None): endpoint_url, params=query_params, headers=self.headers(), - timeout=60) + timeout=60, + ) ) return secret @@ -517,14 +523,17 @@ def search_secrets(self, query_params=None): endpoint_url = f"{self.api_url}/secrets" if query_params is None: - return self.process(requests.get(endpoint_url, headers=self.headers(), timeout=60)).text + return self.process( + requests.get(endpoint_url, headers=self.headers(), timeout=60) + ).text else: return self.process( requests.get( endpoint_url, params=query_params, headers=self.headers(), - timeout=60) + timeout=60, + ) ).text def lookup_folders(self, query_params=None): @@ -568,7 +577,9 @@ def get_secret_ids_by_folderid(self, folder_id): params = {"filter.folderId": folder_id} endpoint_url = f"{self.api_url}/secrets/search-total" params["take"] = self.process( - requests.get(endpoint_url, params=params, headers=self.headers(), timeout=60) + requests.get( + endpoint_url, params=params, headers=self.headers(), timeout=60 + ) ).text response = self.search_secrets(query_params=params) diff --git a/tests/test_server.py b/tests/test_server.py index af900a7..5675f51 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -32,6 +32,7 @@ def test_api_url(secret_server, env_vars): == f"https://{env_vars['tenant']}.secretservercloud.com/api/v1" ) + def test_access_token_authorizer(env_vars, authorizer): assert SecretServer( f"https://{env_vars['tenant']}.secretservercloud.com/",