validate_atomic
Validate atomic test YAML against the official Atomic Red Team schema. Get structural checks, required field verification, and best practice warnings.
Instructions
Validate an atomic test YAML string against the official Atomic Red Team schema.
This tool checks if your atomic test follows the correct structure and includes all required fields. Use this before finalizing any atomic test to ensure it meets the quality standards and can be properly parsed by Atomic Red Team tools.
The validator performs two levels of checks:
Structural validation: Ensures all required fields are present and properly typed
Best practice warnings: Flags common issues that should be addressed
Args: yaml_string: The complete YAML string of the atomic test to validate. Should include all fields like name, description, supported_platforms, executor, etc. as defined in the schema.
Returns: ValidationOutput: Structured validation result containing: - valid (bool): Whether the atomic test passes validation - message (str): Human-readable success/error message with warnings prominently displayed - atomic_name (str): Name of the atomic test (only if valid) - supported_platforms (list): Platforms the test supports (only if valid) - warnings (list): List of warning messages for best practice violations (only if present) - error (str): Detailed error message (only if invalid)
Validation Warnings: The tool will flag these common issues with ⚠️ warnings: - Presence of 'auto_generated_guid' field (should be auto-generated, not manually set) - Use of echo/print/Write-Host commands (discouraged in test commands)
Warnings do not cause validation to fail, but should be addressed before finalizing.Examples: # Valid atomic test yaml_str = ''' name: Test PowerShell Execution description: Execute a PowerShell command supported_platforms: - windows executor: name: powershell command: Get-Process ''' result = validate_atomic(yaml_str, ctx) # result.valid == True, result.message contains success message
# Test with warnings (still valid but needs improvement)
yaml_str = '''
name: Test with Echo
description: Test with echo command
supported_platforms:
- linux
executor:
name: bash
command: echo "Hello World"
'''
result = validate_atomic(yaml_str, ctx)
# result.valid == True, result.warnings contains warning messages
# Invalid atomic test (missing required field)
yaml_str = '''
name: Incomplete Test
description: Missing supported_platforms
executor:
name: bash
command: ls
'''
result = validate_atomic(yaml_str, ctx)
# result.valid == False, result.error contains error messageRaises: No exceptions are raised - all errors are returned in the ValidationOutput model.
Notes: - Always check the 'valid' field before using the atomic test - Address all warnings even if validation succeeds - Warnings are displayed with ⚠️ emoji for visibility - The 'message' field contains formatted text with warnings prominently shown
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| yaml_string | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | Detailed error message (only if invalid) | |
| valid | Yes | Whether the atomic test passed structural validation | |
| message | Yes | Human-readable validation message with warnings prominently displayed | |
| warnings | No | List of best practice warnings that should be addressed | |
| atomic_name | No | Name of the atomic test (only if valid) | |
| supported_platforms | No | Platforms the test supports (only if valid) |