Bug: Server can't fails registration with unexpected fields #1

Open
opened 2024-09-07 19:30:19 +00:00 by agatha · 1 comment
Owner

Describe the bug:
When an agent sends unexpected fields in an initial registration payload, the server fails to register the agent:

2024-09-07 19:18:30.403 | INFO     | __main__:start:43 - Listening on 0.0.0.0:9999
2024-09-07 19:18:43.102 | INFO     | __main__:start:46 - Connection from ('172.17.0.1', 57854)
2024-09-07 19:18:51.396 | ERROR    | __main__:register_agent:115 - Error registering agent: 'junk' is an invalid keyword argument for Agent
2024-09-07 19:18:51.397 | INFO     | __main__:handle_agent:73 - Agent None registered from ('172.17.0.1', 57854)

Reproduction steps:
Send the following payload:

{"platform": "freebsd", "processor": "amd", "memory": 16, "junk": 1234}
**Describe the bug**: When an agent sends unexpected fields in an initial registration payload, the server fails to register the agent: ``` 2024-09-07 19:18:30.403 | INFO | __main__:start:43 - Listening on 0.0.0.0:9999 2024-09-07 19:18:43.102 | INFO | __main__:start:46 - Connection from ('172.17.0.1', 57854) 2024-09-07 19:18:51.396 | ERROR | __main__:register_agent:115 - Error registering agent: 'junk' is an invalid keyword argument for Agent 2024-09-07 19:18:51.397 | INFO | __main__:handle_agent:73 - Agent None registered from ('172.17.0.1', 57854) ``` **Reproduction steps**: Send the following payload: ```json {"platform": "freebsd", "processor": "amd", "memory": 16, "junk": 1234} ```
agatha changed title from Issue: Server can't fails registration with unexpected fields to Bug: Server can't fails registration with unexpected fields 2024-09-07 19:32:57 +00:00
Author
Owner

Issue will remain open to discussion, but the "fix" for now is to just fail silently. There may be scenarios where we might want extra data in the registration payload, however this will prevent malformed registration payload spamming.

Issue will remain open to discussion, but the "fix" for now is to just fail silently. There may be scenarios where we might want extra data in the registration payload, however this will prevent malformed registration payload spamming.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: agatha/pyc2#1
No description provided.