Skip to content

Add architecture field to agent deployment commands#3260

Merged
deacon-mp merged 2 commits intomasterfrom
agent-architecture
Mar 16, 2026
Merged

Add architecture field to agent deployment commands#3260
deacon-mp merged 2 commits intomasterfrom
agent-architecture

Conversation

@clenk
Copy link
Copy Markdown
Contributor

@clenk clenk commented Mar 3, 2026

Description

Related changes in agent repos will add a new input field to some agent deployment commands in the agent deployment modal. The changes here add this field to the agent config and allow it to persist the default value between server restarts.

Depends on mitre/sandcat#455
Depends on mitre/manx#49
Depends on mitre/magma#86

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Ran the server, opened the modal and inspected visually.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 3, 2026

1 similar comment
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for an architecture field in the global agent configuration so agent deployment commands can reference/persist a default architecture value across server restarts.

Changes:

  • Adds an architecture parameter to ConfigApiManager.update_global_agent_config and persists it into the agents config.
  • Introduces a default architecture: amd64 value in conf/agents.yml.
  • Adds a manager-layer validation test to ensure empty architecture values are rejected.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
app/api/v2/managers/config_api_manager.py Accepts and stores architecture in the global agent config update path.
conf/agents.yml Provides a default architecture value in the shipped agent config.
tests/api/v2/managers/test_config_api_manager.py Adds validation coverage for invalid architecture input.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 87 to 90
async def update_global_agent_config(self, sleep_min: int = None, sleep_max: int = None, watchdog: int = None,
untrusted_timer: int = None, implant_name: str = None, bootstrap_abilities: List[str] = None, deadman_abilities=None):
untrusted_timer: int = None, implant_name: str = None, architecture: str = None,
bootstrap_abilities: List[str] = None, deadman_abilities=None):
set_config = self._config_interface.set_config
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

architecture was added to update_global_agent_config, but the REST layer currently uses AgentConfigUpdateSchema to load request JSON. That schema does not define an architecture field, so requests that include it will raise a marshmallow validation error (unknown field) and the UI won’t be able to persist this value. Add architecture = fields.String() to AgentConfigUpdateSchema (and ensure it is included in the dump response as well).

Copilot uses AI. Check for mistakes.
with pytest.raises(errors.DataValidationError):
await manager.update_global_agent_config(architecture='')


Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds validation coverage for an empty architecture, but there’s still no test asserting the happy-path behavior (that a valid architecture value actually updates the stored agent config). Adding a simple assertion-based test (or extending an existing one) would better prove the new feature works end-to-end at the manager layer.

Suggested change
async def test_update_global_agent_config_updates_architecture(base_world, data_svc):
manager = ConfigApiManager(data_svc, None)
await manager.update_global_agent_config(architecture='x86')
agent_config = manager.get_filtered_config('agents')
assert agent_config['architecture'] == 'x86'

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

clenk and others added 2 commits March 15, 2026 19:50
…h test

- architecture field was missing from AgentConfigUpdateSchema, causing
  API requests with architecture to fail marshmallow validation
- adds test asserting architecture value is stored in agents config
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sonarqubecloud
Copy link
Copy Markdown

@sonarqubecloud
Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@sonarqubecloud
Copy link
Copy Markdown

@deacon-mp deacon-mp merged commit 8373f7c into master Mar 16, 2026
19 checks passed
@deacon-mp deacon-mp deleted the agent-architecture branch March 16, 2026 00:11
fionamccrae pushed a commit that referenced this pull request Mar 16, 2026
* Add architecture field to agent deployment cmds

* fix: add architecture field to AgentConfigUpdateSchema; add happy-path test

- architecture field was missing from AgentConfigUpdateSchema, causing
  API requests with architecture to fail marshmallow validation
- adds test asserting architecture value is stored in agents config

---------

Co-authored-by: Chris Lenk <402940+clenk@users.noreply.github.com>
Co-authored-by: deacon <marksoccerman1@aol.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants