diff --git a/monkey/common/agent_configuration/agent_configuration.py b/monkey/common/agent_configuration/agent_configuration.py index 9dbc5b3a4..ee8ac48b6 100644 --- a/monkey/common/agent_configuration/agent_configuration.py +++ b/monkey/common/agent_configuration/agent_configuration.py @@ -1,11 +1,12 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, List, Mapping +from typing import Any, Mapping, Tuple -from marshmallow import Schema, fields, post_load +from marshmallow import Schema, fields from marshmallow.exceptions import MarshmallowError +from ..utils.code_utils import freeze_lists_in_dict from .agent_sub_configuration_schemas import ( CustomPBAConfigurationSchema, PluginConfigurationSchema, @@ -16,7 +17,6 @@ from .agent_sub_configurations import ( PluginConfiguration, PropagationConfiguration, ) -from ..utils.code_utils import freeze_lists_in_dict class InvalidConfigurationError(Exception): @@ -34,9 +34,9 @@ class InvalidConfigurationError(Exception): class AgentConfiguration: keep_tunnel_open_time: float custom_pbas: CustomPBAConfiguration - post_breach_actions: List[PluginConfiguration] - credential_collectors: List[PluginConfiguration] - payloads: List[PluginConfiguration] + post_breach_actions: Tuple[PluginConfiguration] + credential_collectors: Tuple[PluginConfiguration] + payloads: Tuple[PluginConfiguration] propagation: PropagationConfiguration def __post_init__(self): diff --git a/monkey/common/agent_configuration/agent_sub_configurations.py b/monkey/common/agent_configuration/agent_sub_configurations.py index d93b4d774..7a3b88898 100644 --- a/monkey/common/agent_configuration/agent_sub_configurations.py +++ b/monkey/common/agent_configuration/agent_sub_configurations.py @@ -1,5 +1,5 @@ from dataclasses import dataclass -from typing import Dict, List +from typing import Dict, Tuple @dataclass(frozen=True) @@ -18,10 +18,10 @@ class PluginConfiguration: @dataclass(frozen=True) class ScanTargetConfiguration: - blocked_ips: List[str] - inaccessible_subnets: List[str] + blocked_ips: Tuple[str] + inaccessible_subnets: Tuple[str] local_network_scan: bool - subnets: List[str] + subnets: Tuple[str] @dataclass(frozen=True) @@ -32,27 +32,27 @@ class ICMPScanConfiguration: @dataclass(frozen=True) class TCPScanConfiguration: timeout: float - ports: List[int] + ports: Tuple[int] @dataclass(frozen=True) class NetworkScanConfiguration: tcp: TCPScanConfiguration icmp: ICMPScanConfiguration - fingerprinters: List[PluginConfiguration] + fingerprinters: Tuple[PluginConfiguration] targets: ScanTargetConfiguration @dataclass(frozen=True) class ExploitationOptionsConfiguration: - http_ports: List[int] + http_ports: Tuple[int] @dataclass(frozen=True) class ExploitationConfiguration: options: ExploitationOptionsConfiguration - brute_force: List[PluginConfiguration] - vulnerability: List[PluginConfiguration] + brute_force: Tuple[PluginConfiguration] + vulnerability: Tuple[PluginConfiguration] @dataclass(frozen=True)