Skip to content

[Bug]: CYSTCoordinator hardcodes agent role and breaks register/reset contract (join/reset fail) #484

@verovaleros

Description

@verovaleros

Bug Description

netsecgame/game/worlds/CYSTCoordinator.py has multiple critical defects that make CYST integration non-functional and unsafe:

  1. register_agent forcibly overwrites the provided role with "Attacker":
# CYSTCoordinator.py:64-67
async def register_agent(self, agent_id:tuple, agent_role:str, agent_initial_view:dict)->GameState:
    self.logger.debug(f"Registering agent {agent_id} in the world.")
    agent_role = "Attacker"

This discards caller intent and stores only attacker role in _known_agent_roles.

  1. register_agent / reset_agent method signatures do not match the base GameCoordinator contract.

Base calls pass 4 logical parameters (agent_id, agent_role, agent_initial_view, agent_win_condition_view) and expect a tuple (game_state, goal_state), but CYSTCoordinator overrides accept only 3 parameters and return a single GameState.

CYSTCoordinator signatures:

async def register_agent(self, agent_id:tuple, agent_role:str, agent_initial_view:dict)->GameState
async def reset_agent(self, agent_id:tuple, agent_role:str, agent_initial_view:dict)->GameState

This causes runtime failures in join/reset flows.

  1. get_starting_position_from_cyst_config has an indentation bug that writes starting_positions[...] outside if active_service.type == "netsecenv_agent", so hosts/networks can be referenced before assignment for non-agent services.
# CYSTCoordinator.py:30-39 (current)
if active_service.type == "netsecenv_agent":
    hosts = set()
    networks = set()
    ...
starting_positions[f"{obj.id}.{active_service.name}"] = {"known_hosts":hosts, "known_networks":networks}

Steps to Reproduce

  1. Start CYST coordinator world.
  2. Send JoinGame from any agent.
  3. Observe join path calls register_agent(..., initial_view, win_condition_view) and fails due to signature mismatch / unpack expectation.
  4. For role corruption, inspect register_agent: role is overwritten to "Attacker" before cyst-id assignment.
  5. For indentation bug, use CYST config with a non-netsecenv_agent active service before a netsecenv_agent on a node and call get_starting_position_from_cyst_config; observe exception due to uninitialized hosts/networks.

Expected Behavior

  1. register_agent must honor the passed role and never hardcode role elevation.
  2. register_agent and reset_agent in CYSTCoordinator must match base contract:
    • accept agent_win_condition_view
    • return (GameState, GameState).
  3. get_starting_position_from_cyst_config should populate starting_positions only inside if active_service.type == "netsecenv_agent".

Version

1.1

Installation / Deployment Method

Running locally from source

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions