A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.
fix(core): prevent sketch break on sick node
dextmorgn86584ba84ede
diff --git a/flowsint-core/src/flowsint_core/core/graph/serializer.py b/flowsint-core/src/flowsint_core/core/graph/serializer.pyindex 9061eb3b..2dbad02e 100644--- a/flowsint-core/src/flowsint_core/core/graph/serializer.py+++ b/flowsint-core/src/flowsint_core/core/graph/serializer.py@@ -8,15 +8,15 @@ into Neo4j-compatible primitive types, following the Single Responsibility Princfrom typing import Any, Callable, Dict, List, Optional, Typefrom flowsint_types import FlowsintType-from pydantic import BaseModel--# Callable that resolves a type name to a FlowsintType subclass (or None).-TypeResolver = Callable[[str], Optional[Type[FlowsintType]]]+from pydantic import BaseModel, ValidationErrorfrom flowsint_core.utils import flatten, unflattenfrom .types import GraphEdge, GraphNode, NodeMetadata+# Callable that resolves a type name to a FlowsintType subclass (or None).+TypeResolver = Callable[[str], Optional[Type[FlowsintType]]]+class GraphSerializer:"""@@ -62,13 +62,24 @@ class GraphSerializer:type_resolver: Optional[TypeResolver] = None,) -> FlowsintType:if not type_resolver:- from flowsint_core.core.services.type_registry_service import local_type_resolver+ from flowsint_core.core.services.type_registry_service import (+ local_type_resolver,+ )+type_resolver = local_type_resolverDetectedType = type_resolver(nodeType)if not DetectedType:raise ValueError(f"Unknown type: {nodeType}")properties = GraphSerializer._clean_empty_values(entity)- return DetectedType(**properties)+ try:+ return DetectedType(**properties)+ except ValidationError as e:+ # if fields fail let's still return the object with problematic fields filtered+ invalid_fields = {err["loc"][0] for err in e.errors()}+ cleaned_props = {+ k: v for k, v in properties.items() if k not in invalid_fields+ }+ return DetectedType(**cleaned_props)@staticmethoddef graph_node_to_flowsint_type(node: GraphNode) -> FlowsintType: