Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exploiter order not preserved #2860

Closed
2 of 3 tasks
mssalvatore opened this issue Jan 19, 2023 · 0 comments · Fixed by #3014
Closed
2 of 3 tasks

Exploiter order not preserved #2860

mssalvatore opened this issue Jan 19, 2023 · 0 comments · Fixed by #3014
Labels
Bug An error, flaw, misbehavior or failure in the Monkey or Monkey Island. Complexity: Low Impact: Low sp/1
Milestone

Comments

@mssalvatore
Copy link
Collaborator

mssalvatore commented Jan 19, 2023

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
@mssalvatore mssalvatore added the Bug An error, flaw, misbehavior or failure in the Monkey or Monkey Island. label Jan 19, 2023
@mssalvatore mssalvatore changed the title WIP: Exploiter order not preserved Exploiter order not preserved Jan 19, 2023
mssalvatore added a commit that referenced this issue Jan 19, 2023
@mssalvatore mssalvatore added this to the v2.1.0 milestone Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug An error, flaw, misbehavior or failure in the Monkey or Monkey Island. Complexity: Low Impact: Low sp/1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant