Skip to content

Exploiter order not preserved #2860

@mssalvatore

Description

@mssalvatore

Description

It appears that sometimes exploiter order may not be preserved
image

diff --git a/monkey/infection_monkey/island_api_client/http_island_api_client.py b/monkey/infection_monkey/island_api_client/http_island_api_client.py
index c044cf664..4c36c3fd8 100644
--- a/monkey/infection_monkey/island_api_client/http_island_api_client.py
+++ b/monkey/infection_monkey/island_api_client/http_island_api_client.py
@@ -96,9 +96,13 @@ class HTTPIslandAPIClient(IIslandAPIClient):
         response = self.http_client.get("agent-configuration", timeout=SHORT_REQUEST_TIMEOUT)
 
         config_dict = response.json()
-        logger.debug(f"Received configuration:\n{pformat(config_dict)}")
+        logger.debug(f"Raw JSON configuration:\n{pformat(config_dict)}")
+
+        agent_configuration = AgentConfiguration(**config_dict)
+        logger.debug(f"Received config {agent_configuration}")
+
+        return agent_configuration
 
-        return AgentConfiguration(**config_dict)
 
     @handle_response_parsing_errors
     def get_credentials_for_propagation(self) -> Sequence[Credentials]:

Update:

Order is preserved. This is simply a matter of display, but that can't be resolved until we upgrade to Python3.8. See 6ef9179.

A unit test was added in 09c7540 to ensure that order is preserved.

Tasks

  • Fix it (0.25d) @mssalvatore
    • Change pformat() call to not sort dictionaries
    • Add back in (or improve) the unit test from 09c7540

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugAn error, flaw, misbehavior or failure in the Monkey or Monkey Island.Complexity: LowImpact: Lowsp/1

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions