From 343b8efb743875b60f54f550058e0a6f594949b6 Mon Sep 17 00:00:00 2001 From: Tal Borenstein Date: Mon, 11 Nov 2024 17:55:18 +0200 Subject: [PATCH 1/2] fix: servicenow provider timeout in validate scopes --- keep/providers/servicenow_provider/servicenow_provider.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/keep/providers/servicenow_provider/servicenow_provider.py b/keep/providers/servicenow_provider/servicenow_provider.py index 46ed94447..8f3c5facd 100644 --- a/keep/providers/servicenow_provider/servicenow_provider.py +++ b/keep/providers/servicenow_provider/servicenow_provider.py @@ -78,6 +78,7 @@ def validate_scopes(self): Validates that the user has the required scopes to use the provider. """ try: + self.logger.info("Validating ServiceNow scopes") url = f"{self.authentication_config.service_now_base_url}/api/now/table/sys_user_role?sysparm_query=user_name={self.authentication_config.username}" response = requests.get( url, @@ -86,19 +87,23 @@ def validate_scopes(self): self.authentication_config.password, ), verify=False, + timeout=3, ) if response.status_code == 200: roles = response.json() roles_names = [role.get("name") for role in roles.get("result")] if "itil" in roles_names: + self.logger.info("User has ITIL role") scopes = { "itil": True, } else: + self.logger.info("User does not have ITIL role") scopes = { "itil": "This user does not have the ITIL role", } else: + self.logger.info("Failed to get roles from ServiceNow") scopes["itil"] = "Failed to get roles from ServiceNow" except Exception as e: self.logger.exception("Error validating scopes") From 05a7b8b3baa638eb72c502e3224b3c6d41ed48a4 Mon Sep 17 00:00:00 2001 From: Tal Borenstein Date: Mon, 11 Nov 2024 17:56:34 +0200 Subject: [PATCH 2/2] fix: 10 --- keep/providers/servicenow_provider/servicenow_provider.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keep/providers/servicenow_provider/servicenow_provider.py b/keep/providers/servicenow_provider/servicenow_provider.py index 8f3c5facd..8c15c3a0f 100644 --- a/keep/providers/servicenow_provider/servicenow_provider.py +++ b/keep/providers/servicenow_provider/servicenow_provider.py @@ -87,7 +87,7 @@ def validate_scopes(self): self.authentication_config.password, ), verify=False, - timeout=3, + timeout=10, ) if response.status_code == 200: roles = response.json()