A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.
fix(mypy): type annotations across enrichers, models, logger, utils
dextmorgn4289d2630b89
diff --git a/flowsint-core/src/flowsint_core/core/enricher_base.py b/flowsint-core/src/flowsint_core/core/enricher_base.pyindex 767c8ea2..56d758ba 100644--- a/flowsint-core/src/flowsint_core/core/enricher_base.py+++ b/flowsint-core/src/flowsint_core/core/enricher_base.py@@ -1,9 +1,11 @@from abc import ABC, abstractmethod-from typing import Any, Dict, List, Optional+from typing import Any, Dict, List, Optional, Typefrom pydantic import BaseModel, Field, TypeAdapter, ValidationError, create_modelfrom pydantic.config import ConfigDict+from flowsint_types import FlowsintType+from ..utils import resolve_typefrom .graph import GraphService, create_graph_servicefrom .logger import Logger@@ -14,7 +16,7 @@ class InvalidEnricherParams(Exception):pass-def build_params_model(params_schema: list) -> BaseModel:+def build_params_model(params_schema: list) -> Type[BaseModel]:"""Build a strict Pydantic model from a params_schema.Unknown fields will raise a validation error.@@ -42,7 +44,9 @@ def build_params_model(params_schema: list) -> BaseModel:Field(default=default, description=param.get("description", "")),)- model = create_model("ParamsModel", __config__=ConfigDict(extra="forbid"), **fields)+ model: Type[BaseModel] = create_model(+ "ParamsModel", __config__=ConfigDict(extra="forbid"), **fields+ )return model@@ -137,7 +141,7 @@ class Enricher(ABC):# vaultSecret references, not the key directly. The idea is that the real key values are resolved after calling# async_init(), right before the execution.- async def async_init(self):+ async def async_init(self) -> None:self.ParamsModel = build_params_model(self.params_schema)# Always resolve parameters, even if self.params is empty@@ -411,7 +415,7 @@ class Enricher(ABC):return cleaneddef postprocess(- self, results: List[Dict[str, Any]], input_data: List[str] = None+ self, results: List[Dict[str, Any]], input_data: Optional[List[str]] = None) -> List[Dict[str, Any]]:return results@@ -442,7 +446,7 @@ class Enricher(ABC):)return []- def create_node(self, node_obj) -> None:+ def create_node(self, node_obj: FlowsintType) -> None:"""Create a single Neo4j node.@@ -465,9 +469,9 @@ class Enricher(ABC):def create_relationship(self,- from_obj,- to_obj,- rel_label="IS_RELATED_TO",+ from_obj: BaseModel,+ to_obj: BaseModel,+ rel_label: str = "IS_RELATED_TO",) -> None:"""Create a relationship between two nodes.diff --git a/flowsint-core/src/flowsint_core/core/graph/serializer.py b/flowsint-core/src/flowsint_core/core/graph/serializer.pyindex 0cf51195..2054c095 100644--- a/flowsint-core/src/flowsint_core/core/graph/serializer.py+++ b/flowsint-core/src/flowsint_core/core/graph/serializer.py@@ -27,9 +27,9 @@ class GraphSerializer:"""@staticmethod- def _clean_empty_values(data: Dict[str, Any]) -> dict:+ def _clean_empty_values(data: Dict[str, Any]) -> Dict[str, Any]:"""Remove empty string values from dict to avoid Pydantic validation errors."""- cleaned = {}+ cleaned: Dict[str, Any] = {}for key, value in data.items():if value == "" or value is None:continue@@ -54,7 +54,7 @@ class GraphSerializer:return cleaned@staticmethod- def flatten(dict: Dict[str, Any]):+ def flatten(dict: Dict[str, Any]) -> Dict[str, Any]:return flatten(dict, remove_empty=False)@staticmethoddiff --git a/flowsint-core/src/flowsint_core/core/logger.py b/flowsint-core/src/flowsint_core/core/logger.pyindex d8668dc9..39a89c1d 100644--- a/flowsint-core/src/flowsint_core/core/logger.py+++ b/flowsint-core/src/flowsint_core/core/logger.py@@ -14,7 +14,7 @@ import threadingimport timefrom datetime import datetime, timezonefrom queue import Empty, Queue-from typing import Dict, Optional, Union+from typing import Dict, List, Optional, Tuple, Unionfrom uuid import UUIDfrom ..tasks.event import emit_event_task@@ -36,10 +36,11 @@ class LoggerSingleton:_instance: Optional["LoggerSingleton"] = None_lock = threading.Lock()+ _initialized: booldef __new__(cls, batch_size: int = 50, flush_interval: float = 2.0, auto_start: bool = True- ):+ ) -> "LoggerSingleton":"""Thread-safe singleton implementation using double-checked locking."""if cls._instance is None:with cls._lock:@@ -51,7 +52,7 @@ class LoggerSingleton:def __init__(self, batch_size: int = 50, flush_interval: float = 2.0, auto_start: bool = True- ):+ ) -> None:"""Initialize the Logger singleton.@@ -69,7 +70,7 @@ class LoggerSingleton:self._flush_interval = flush_interval# Queue for batch insertion (contains: sequence, timestamp, sketch_id, level, content)- self._log_queue: Queue = Queue()+ self._log_queue: "Queue[Tuple[int, datetime, str, EventLevel, Dict]]" = Queue()# Monotonic sequence counter for ordering (thread-safe with lock)self._sequence_counter = 0@@ -124,7 +125,7 @@ class LoggerSingleton:if self._log_queue.empty():return- logs_to_insert = []+ logs_to_insert: List[Tuple[int, datetime, str, EventLevel, Dict]] = []# Collect logs from queuewhile not self._log_queue.empty() and (diff --git a/flowsint-core/src/flowsint_core/core/models.py b/flowsint-core/src/flowsint_core/core/models.pyindex 826db25e..89136840 100644--- a/flowsint-core/src/flowsint_core/core/models.py+++ b/flowsint-core/src/flowsint_core/core/models.py@@ -1,6 +1,7 @@import jsonimport uuidfrom datetime import datetime, timezone+from typing import Any, List, Optionalfrom sqlalchemy import (JSON,@@ -18,6 +19,7 @@ from sqlalchemy import (func,)from sqlalchemy import Enum as SQLEnum+from sqlalchemy.engine import Dialectfrom sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationshipfrom sqlalchemy.types import TypeDecorator@@ -31,12 +33,14 @@ class RoleListType(TypeDecorator):impl = Textcache_ok = True- def process_bind_param(self, value, dialect):+ def process_bind_param(self, value: Optional[List[Any]], dialect: Dialect) -> str:if value is not None:return json.dumps([r.value if isinstance(r, Role) else r for r in value])return "[]"- def process_result_value(self, value, dialect):+ def process_result_value(+ self, value: Optional[str], dialect: Dialect+ ) -> List[Role]:if value is not None:return [Role(r.lower()) for r in json.loads(value)]return []@@ -101,7 +105,10 @@ class Log(Base):ForeignKey("sketches.id", onupdate="CASCADE", ondelete="CASCADE"),nullable=True,)- type = Column(SQLEnum(EventLevel), default=EventLevel.INFO)+ # Legacy Column() declarative style (not mapped_column/Mapped[...] like+ # the rest of this class) — no sqlalchemy mypy plugin configured to+ # infer its Python-side type, so mypy sees Column[Never] here.+ type: Any = Column(SQLEnum(EventLevel), default=EventLevel.INFO)class Profile(Base):@@ -126,7 +133,8 @@ class Scan(Base):ForeignKey("sketches.id", onupdate="CASCADE", ondelete="CASCADE"),nullable=True,)- status = Column(SQLEnum(EventLevel), default=EventLevel.PENDING)+ # Same legacy Column() style as Log.type above.+ status: Any = Column(SQLEnum(EventLevel), default=EventLevel.PENDING)started_at = Column(DateTime, default=lambda: datetime.now(timezone.utc))completed_at = Column(DateTime, nullable=True)error = Column(Text, nullable=True)@@ -135,7 +143,7 @@ class Scan(Base):# Relationshipssketch = relationship("Sketch", back_populates="scans")- def __repr__(self):+ def __repr__(self) -> str:return f"<Scan(id={self.id}, status={self.status})>"diff --git a/flowsint-core/src/flowsint_core/core/postgre_db.py b/flowsint-core/src/flowsint_core/core/postgre_db.pyindex d1a8cc0e..cc530f3b 100644--- a/flowsint-core/src/flowsint_core/core/postgre_db.py+++ b/flowsint-core/src/flowsint_core/core/postgre_db.py@@ -1,4 +1,5 @@import os+from typing import Generatorfrom dotenv import load_dotenvfrom sqlalchemy import create_engine@@ -15,7 +16,7 @@ SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)Base = declarative_base()-def get_db() -> Session:+def get_db() -> Generator[Session, None, None]:db = SessionLocal()try:yield dbdiff --git a/flowsint-core/src/flowsint_core/core/services/sketch_service.py b/flowsint-core/src/flowsint_core/core/services/sketch_service.pyindex 5b981a3b..6d6f6b27 100644--- a/flowsint-core/src/flowsint_core/core/services/sketch_service.py+++ b/flowsint-core/src/flowsint_core/core/services/sketch_service.py@@ -4,7 +4,7 @@ Sketch service for managing sketches and graph operations.from __future__ import annotations-from typing import TYPE_CHECKING, Any, Dict, List, Optional+from typing import TYPE_CHECKING, Any, Dict, List, Optional, Unionfrom uuid import UUIDfrom sqlalchemy.orm import Session@@ -34,8 +34,8 @@ class SketchService(BaseService):sketch_repo: SketchRepository,investigation_repo: InvestigationRepository,type_registry_service: Optional[TypeRegistryService] = None,- **kwargs,- ):+ **kwargs: Any,+ ) -> None:super().__init__(db, **kwargs)self._sketch_repo = sketch_repoself._investigation_repo = investigation_repo@@ -110,9 +110,12 @@ class SketchService(BaseService):# --- Graph operations ---+ # format="inline" returns a flat list of {source, edge, target} dicts+ # instead of the default {nds, rls}-shaped graph — same distinction the+ # frontend's sketchService.getGraphDataById overload encodes.def get_graph(self, sketch_id: UUID, user_id: UUID, format: Optional[str] = None- ) -> Dict[str, Any]:+ ) -> Union[Dict[str, Any], List[Dict[str, Any]]]:self._get_sketch_with_permission(sketch_id, user_id, ["read"])resolver = (diff --git a/flowsint-core/src/flowsint_core/utils.py b/flowsint-core/src/flowsint_core/utils.pyindex 470cf516..62dd2722 100644--- a/flowsint-core/src/flowsint_core/utils.py+++ b/flowsint-core/src/flowsint_core/utils.py@@ -3,7 +3,7 @@ import ipaddressimport reimport socketimport ssl-from typing import Any, Dict, List, Type+from typing import Any, Dict, List, Optional, Tuple, Type, castfrom urllib.parse import urlparseimport phonenumbers@@ -128,7 +128,7 @@ def is_valid_asn(asn: str) -> bool:return 0 <= asn_num <= 4294967295-def resolve_type(details: dict, schema_context: dict = None) -> str:+def resolve_type(details: dict, schema_context: Optional[dict] = None) -> str:if "anyOf" in details:types = []for option in details["anyOf"]:@@ -147,11 +147,11 @@ def resolve_type(details: dict, schema_context: dict = None) -> str:if details["type"] == "array":item_type = resolve_type(details.get("items", {}), schema_context)return f"{item_type}[]"- return details["type"]+ return str(details["type"])# Handle $ref in array items or other contextsif "$ref" in details and schema_context:- ref_path = details["$ref"]+ ref_path = str(details["$ref"])if ref_path.startswith("#/$defs/"):ref_name = ref_path.split("/")[-1]return ref_name@@ -191,12 +191,17 @@ def get_domain_from_ssl(ip: str, port: int = 443) -> str | None:with socket.create_connection((ip, port), timeout=3) as sock:with context.wrap_socket(sock, server_hostname=ip) as ssock:cert = ssock.getpeercert()- subject = cert.get("subject", [])+ if not cert:+ return None+ subject = cast(+ Tuple[Tuple[Tuple[str, str], ...], ...],+ cert.get("subject", ()),+ )for entry in subject:if entry[0][0] == "commonName":return entry[0][1]# Alternative: check subjectAltName- san = cert.get("subjectAltName", [])+ san = cast(Tuple[Tuple[str, str], ...], cert.get("subjectAltName", ()))for typ, val in san:if typ == "DNS":return val@@ -311,11 +316,11 @@ def unflatten(data: Dict[str, Any], *, separator: str = ".") -> Dict[str, Any]:def get_inline_relationships(nodes: List[GraphNode], edges: List[GraphEdge]-) -> List[str]:+) -> List[Dict[str, Any]]:"""Get the inline relationships for a list of nodes and edges."""- relationships = []+ relationships: List[Dict[str, Any]] = []for edge in edges:source = next((node for node in nodes if node.id == edge.source), None)target = next((node for node in nodes if node.id == edge.target), None)@@ -324,7 +329,7 @@ def get_inline_relationships(return relationships-def to_json_serializable(obj):+def to_json_serializable(obj: Any) -> Any:"""Convert any object to a JSON-serializable format."""import jsondiff --git a/flowsint-enrichers/pyproject.toml b/flowsint-enrichers/pyproject.tomlindex 2c7c6348..387b6bd2 100644--- a/flowsint-enrichers/pyproject.toml+++ b/flowsint-enrichers/pyproject.toml@@ -75,3 +75,13 @@ disable_error_code = ["valid-type", "attr-defined", "name-defined"][[tool.mypy.overrides]]module = "tests.*"disallow_untyped_defs = false++# Tool.launch's abstract signature is deliberately loose+# (self, value: str, *args, **kwargs) -> Any — every subclass (dnsx,+# httpx, subfinder, whoxy, sirene, ...) defines its own real,+# tool-specific launch() signature instead. Same shape as the Enricher+# InputType/OutputType pattern above: intentional flexibility mypy's+# override checking can't express, not a mistake to fix per-subclass.+[[tool.mypy.overrides]]+module = "tools.*"+disable_error_code = ["override"]diff --git a/flowsint-enrichers/src/flowsint_enrichers/crypto/to_nfts.py b/flowsint-enrichers/src/flowsint_enrichers/crypto/to_nfts.pyindex 48f3843a..9587aa7f 100644--- a/flowsint-enrichers/src/flowsint_enrichers/crypto/to_nfts.py+++ b/flowsint-enrichers/src/flowsint_enrichers/crypto/to_nfts.py@@ -5,6 +5,7 @@ import requestsfrom dotenv import load_dotenvfrom flowsint_core.core.enricher_base import Enricher+from flowsint_core.core.vault import VaultProtocolfrom flowsint_enrichers.registry import flowsint_enricherfrom flowsint_types.wallet import CryptoNFT, CryptoWallet@@ -23,7 +24,7 @@ class CryptoWalletAddressToNFTs(Enricher):self,sketch_id: Optional[str] = None,scan_id: Optional[str] = None,- vault=None,+ vault: Optional[VaultProtocol] = None,params: Optional[Dict[str, Any]] = None,):super().__init__(@@ -90,7 +91,7 @@ class CryptoWalletAddressToNFTs(Enricher):def _get_nfts(self, address: str, api_key: str, api_url: str) -> List[CryptoNFT]:nfts = []"""Get nfts for a wallet address."""- params = {+ params: Dict[str, Any] = {"module": "account","action": "tokennfttx","address": address,diff --git a/flowsint-enrichers/src/flowsint_enrichers/domain/to_dehashed.py b/flowsint-enrichers/src/flowsint_enrichers/domain/to_dehashed.pyindex 194f0f30..7a76be94 100644--- a/flowsint-enrichers/src/flowsint_enrichers/domain/to_dehashed.py+++ b/flowsint-enrichers/src/flowsint_enrichers/domain/to_dehashed.py@@ -6,6 +6,7 @@ import requestsfrom flowsint_core.core.enricher_base import Enricherfrom flowsint_core.core.logger import Logger+from flowsint_core.core.vault import VaultProtocolfrom flowsint_enrichers.registry import flowsint_enricherfrom flowsint_types.domain import Domainfrom flowsint_types.individual import Individual@@ -23,7 +24,7 @@ class DomainToDehashed(Enricher):self,sketch_id: Optional[str] = None,scan_id: Optional[str] = None,- vault=None,+ vault: Optional[VaultProtocol] = None,params: Optional[Dict[str, Any]] = None,):super().__init__(@@ -160,7 +161,7 @@ class DomainToDehashed(Enricher):return resultsdef postprocess(- self, results: List[OutputType], input_data: List[InputType] = None+ self, results: List[OutputType], input_data: Optional[List[InputType]] = None) -> List[OutputType]:if not self._graph_service:return resultsdiff --git a/flowsint-enrichers/src/flowsint_enrichers/domain/to_whois_history.py b/flowsint-enrichers/src/flowsint_enrichers/domain/to_whois_history.pyindex 836164c2..1627dec5 100644--- a/flowsint-enrichers/src/flowsint_enrichers/domain/to_whois_history.py+++ b/flowsint-enrichers/src/flowsint_enrichers/domain/to_whois_history.py@@ -7,6 +7,7 @@ from tools.network.whoisxml import WhoisXmlToolfrom flowsint_core.core.enricher_base import Enricherfrom flowsint_core.core.logger import Logger+from flowsint_core.core.vault import VaultProtocolfrom flowsint_enrichers.registry import flowsint_enricherfrom flowsint_types.address import Locationfrom flowsint_types.domain import Domain@@ -29,7 +30,7 @@ class DomainToWhoisHistoryEnricher(Enricher):self,sketch_id: Optional[str] = None,scan_id: Optional[str] = None,- vault=None,+ vault: Optional[VaultProtocol] = None,params: Optional[Dict[str, Any]] = None,):super().__init__(diff --git a/flowsint-enrichers/src/flowsint_enrichers/email/to_dehashed.py b/flowsint-enrichers/src/flowsint_enrichers/email/to_dehashed.pyindex 0cb926b3..d23af9ef 100644--- a/flowsint-enrichers/src/flowsint_enrichers/email/to_dehashed.py+++ b/flowsint-enrichers/src/flowsint_enrichers/email/to_dehashed.py@@ -6,6 +6,7 @@ import requestsfrom flowsint_core.core.enricher_base import Enricherfrom flowsint_core.core.logger import Logger+from flowsint_core.core.vault import VaultProtocolfrom flowsint_enrichers.registry import flowsint_enricherfrom flowsint_types.email import Emailfrom flowsint_types.individual import Individual@@ -23,7 +24,7 @@ class EmailToDehashed(Enricher):self,sketch_id: Optional[str] = None,scan_id: Optional[str] = None,- vault=None,+ vault: Optional[VaultProtocol] = None,params: Optional[Dict[str, Any]] = None,):super().__init__(@@ -160,7 +161,7 @@ class EmailToDehashed(Enricher):return resultsdef postprocess(- self, results: List[OutputType], input_data: List[InputType] = None+ self, results: List[OutputType], input_data: Optional[List[InputType]] = None) -> List[OutputType]:if not self._graph_service:return resultsdiff --git a/flowsint-enrichers/src/flowsint_enrichers/email/to_domains.py b/flowsint-enrichers/src/flowsint_enrichers/email/to_domains.pyindex 59b59d6f..9570675b 100644--- a/flowsint-enrichers/src/flowsint_enrichers/email/to_domains.py+++ b/flowsint-enrichers/src/flowsint_enrichers/email/to_domains.py@@ -7,6 +7,7 @@ from tools.network.whoxy import WhoxyToolfrom flowsint_core.core.enricher_base import Enricherfrom flowsint_core.core.logger import Logger+from flowsint_core.core.vault import VaultProtocolfrom flowsint_enrichers.registry import flowsint_enricherfrom flowsint_types.address import Locationfrom flowsint_types.domain import Domain@@ -31,7 +32,7 @@ class EmailToDomainsEnricher(Enricher):self,sketch_id: Optional[str] = None,scan_id: Optional[str] = None,- vault=None,+ vault: Optional[VaultProtocol] = None,params: Optional[Dict[str, Any]] = None,):super().__init__(@@ -280,7 +281,7 @@ class EmailToDomainsEnricher(Enricher):processed_emails: Set[str],processed_phones: Set[str],processed_addresses: Set[str],- ):+ ) -> None:"""Process a contact and create all related entities and relationships."""# Extract individualdiff --git a/flowsint-enrichers/src/flowsint_enrichers/email/to_leaks.py b/flowsint-enrichers/src/flowsint_enrichers/email/to_leaks.pyindex af074a46..be6e6e2f 100644--- a/flowsint-enrichers/src/flowsint_enrichers/email/to_leaks.py+++ b/flowsint-enrichers/src/flowsint_enrichers/email/to_leaks.py@@ -7,6 +7,7 @@ from dotenv import load_dotenvfrom flowsint_core.core.enricher_base import Enricherfrom flowsint_core.core.logger import Logger+from flowsint_core.core.vault import VaultProtocolfrom flowsint_enrichers.registry import flowsint_enricherfrom flowsint_types.breach import Breachfrom flowsint_types.email import Email@@ -28,7 +29,7 @@ class EmailToBreachesEnricher(Enricher):self,sketch_id: Optional[str] = None,scan_id: Optional[str] = None,- vault=None,+ vault: Optional[VaultProtocol] = None,params: Optional[Dict[str, Any]] = None,):super().__init__(diff --git a/flowsint-enrichers/src/flowsint_enrichers/individual/to_domains.py b/flowsint-enrichers/src/flowsint_enrichers/individual/to_domains.pyindex 920f6058..786a2f63 100644--- a/flowsint-enrichers/src/flowsint_enrichers/individual/to_domains.py+++ b/flowsint-enrichers/src/flowsint_enrichers/individual/to_domains.py@@ -7,6 +7,7 @@ from tools.network.whoxy import WhoxyToolfrom flowsint_core.core.enricher_base import Enricherfrom flowsint_core.core.logger import Logger+from flowsint_core.core.vault import VaultProtocolfrom flowsint_enrichers.registry import flowsint_enricherfrom flowsint_types import Domain, Email, Individual, Location, Phone@@ -27,7 +28,7 @@ class IndividualToDomainsEnricher(Enricher):self,sketch_id: Optional[str] = None,scan_id: Optional[str] = None,- vault=None,+ vault: Optional[VaultProtocol] = None,params: Optional[Dict[str, Any]] = None,):super().__init__(@@ -305,7 +306,7 @@ class IndividualToDomainsEnricher(Enricher):processed_emails: Set[str],processed_phones: Set[str],processed_addresses: Set[str],- ):+ ) -> None:"""Process a contact and create all related entities and relationships."""# Extract individualdiff --git a/flowsint-enrichers/src/flowsint_enrichers/ip/to_dehashed.py b/flowsint-enrichers/src/flowsint_enrichers/ip/to_dehashed.pyindex f90ea441..0912d194 100644--- a/flowsint-enrichers/src/flowsint_enrichers/ip/to_dehashed.py+++ b/flowsint-enrichers/src/flowsint_enrichers/ip/to_dehashed.py@@ -6,6 +6,7 @@ import requestsfrom flowsint_core.core.enricher_base import Enricherfrom flowsint_core.core.logger import Logger+from flowsint_core.core.vault import VaultProtocolfrom flowsint_enrichers.registry import flowsint_enricherfrom flowsint_types.individual import Individualfrom flowsint_types.ip import Ip@@ -23,7 +24,7 @@ class IpToIntelligence(Enricher):self,sketch_id: Optional[str] = None,scan_id: Optional[str] = None,- vault=None,+ vault: Optional[VaultProtocol] = None,params: Optional[Dict[str, Any]] = None,):super().__init__(@@ -162,7 +163,7 @@ class IpToIntelligence(Enricher):return resultsdef postprocess(- self, results: List[OutputType], input_data: List[InputType] = None+ self, results: List[OutputType], input_data: Optional[List[InputType]] = None) -> List[OutputType]:if not self._graph_service:return resultsdiff --git a/flowsint-enrichers/src/flowsint_enrichers/ip/to_ports.py b/flowsint-enrichers/src/flowsint_enrichers/ip/to_ports.pyindex 9b7b1264..ea111281 100644--- a/flowsint-enrichers/src/flowsint_enrichers/ip/to_ports.py+++ b/flowsint-enrichers/src/flowsint_enrichers/ip/to_ports.py@@ -4,6 +4,7 @@ from tools.network.naabu import NaabuToolfrom flowsint_core.core.enricher_base import Enricherfrom flowsint_core.core.logger import Logger+from flowsint_core.core.vault import VaultProtocolfrom flowsint_enrichers.registry import flowsint_enricherfrom flowsint_types.ip import Ipfrom flowsint_types.port import Port@@ -21,7 +22,7 @@ class IpToPortsEnricher(Enricher):self,sketch_id: Optional[str] = None,scan_id: Optional[str] = None,- vault=None,+ vault: Optional[VaultProtocol] = None,params: Optional[Dict[str, Any]] = None,):super().__init__(@@ -187,7 +188,7 @@ class IpToPortsEnricher(Enricher):return resultsdef postprocess(- self, results: List[OutputType], input_data: List[InputType] = None+ self, results: List[OutputType], input_data: Optional[List[InputType]] = None) -> List[OutputType]:"""Create Neo4j nodes for ports and relationships with IP addresses"""if self._graph_service and results:diff --git a/flowsint-enrichers/src/flowsint_enrichers/social/to_dehashed.py b/flowsint-enrichers/src/flowsint_enrichers/social/to_dehashed.pyindex caeb674f..eb867ed1 100644--- a/flowsint-enrichers/src/flowsint_enrichers/social/to_dehashed.py+++ b/flowsint-enrichers/src/flowsint_enrichers/social/to_dehashed.py@@ -6,6 +6,7 @@ import requestsfrom flowsint_core.core.enricher_base import Enricherfrom flowsint_core.core.logger import Logger+from flowsint_core.core.vault import VaultProtocolfrom flowsint_enrichers.registry import flowsint_enricherfrom flowsint_types.individual import Individualfrom flowsint_types.username import Username@@ -23,7 +24,7 @@ class UsernameToDehashed(Enricher):self,sketch_id: Optional[str] = None,scan_id: Optional[str] = None,- vault=None,+ vault: Optional[VaultProtocol] = None,params: Optional[Dict[str, Any]] = None,):super().__init__(@@ -160,7 +161,7 @@ class UsernameToDehashed(Enricher):return resultsdef postprocess(- self, results: List[OutputType], input_data: List[InputType] = None+ self, results: List[OutputType], input_data: Optional[List[InputType]] = None) -> List[OutputType]:if not self._graph_service:return resultsdiff --git a/flowsint-enrichers/src/tools/network/whoxy.py b/flowsint-enrichers/src/tools/network/whoxy.pyindex d21d4912..bd0b2138 100644--- a/flowsint-enrichers/src/tools/network/whoxy.py+++ b/flowsint-enrichers/src/tools/network/whoxy.py@@ -1,5 +1,5 @@import time-from typing import Dict+from typing import Any, Dict, Optionalimport requests@@ -28,8 +28,11 @@ class WhoxyTool(Tool):def category(cls) -> str:return "Network intelligence"- def launch(self, params: Dict[str, str] = {}) -> list[Dict]:- last_exception = None+ # Whoxy's response is a single JSON object (status/total_results/+ # search_result keys, see below) — was declared list[Dict], which+ # never matched `return data` here or callers reading it as a dict.+ def launch(self, params: Dict[str, str] = {}) -> Dict[str, Any]:+ last_exception: Optional[Exception] = Nonefor attempt in range(self.MAX_RETRIES):try:@@ -45,7 +48,7 @@ class WhoxyTool(Tool):continueresp.raise_for_status()- data = resp.json()+ data: Dict[str, Any] = resp.json()if data.get("status") != 1:raise RuntimeError(f"Error querying Whoxy API: {str(data.get('status_reason'))}"