From 0d66517951a580a60dedeb998e8238172f0c2107 Mon Sep 17 00:00:00 2001 From: srgkr <34318308+srgkr@users.noreply.github.com> Date: Wed, 11 Feb 2026 12:02:39 +0300 Subject: [PATCH 1/2] fix: make component connections independent to handle missing permissions --- mpsiemlib/modules/__init__.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/mpsiemlib/modules/__init__.py b/mpsiemlib/modules/__init__.py index c9f54df..5fff44e 100644 --- a/mpsiemlib/modules/__init__.py +++ b/mpsiemlib/modules/__init__.py @@ -23,9 +23,17 @@ def __init__(self, creds, settings: Settings): self.__auth = MPSIEMAuth(self.creds, self.settings) sessions = {} if self.creds.core_hostname: - sessions['core'] = self.__auth.connect(MPComponents.CORE) - sessions['ms'] = self.__auth.connect(MPComponents.MS) - sessions['kb'] = self.__auth.connect(MPComponents.KB) + target_components = [('core', MPComponents.CORE), ('ms', MPComponents.MS), ('kb', MPComponents.KB)] + for name, component in target_components: + try: + session = self.__auth.connect(component) + if session: + sessions[name] = session + else: + self.log.warning(f"Connection to {name} returned empty session. Skipping...") + except Exception as e: + # In case of a 500 error or access denied from the kb (or any other) component + self.log.error(f"Failed to connect to component {name}: {e}. Skipping this component.") # if self.creds.siem_hostname: # sessions['siem'] = self.__auth.connect(MPComponents.SIEM) # if self.creds.storage_hostname: From 9f5c5d1aa10db5b1275085ec629fa1388951ccd5 Mon Sep 17 00:00:00 2001 From: srgkr <34318308+srgkr@users.noreply.github.com> Date: Thu, 12 Feb 2026 23:26:04 +0300 Subject: [PATCH 2/2] fix: skipping a component in case of connection failure --- mpsiemlib/modules/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mpsiemlib/modules/__init__.py b/mpsiemlib/modules/__init__.py index 5fff44e..ef29cad 100644 --- a/mpsiemlib/modules/__init__.py +++ b/mpsiemlib/modules/__init__.py @@ -32,8 +32,7 @@ def __init__(self, creds, settings: Settings): else: self.log.warning(f"Connection to {name} returned empty session. Skipping...") except Exception as e: - # In case of a 500 error or access denied from the kb (or any other) component - self.log.error(f"Failed to connect to component {name}: {e}. Skipping this component.") + self.log.warning(f"Failed to connect to component {name}: {e}. Skipping this component.") # if self.creds.siem_hostname: # sessions['siem'] = self.__auth.connect(MPComponents.SIEM) # if self.creds.storage_hostname: