Files
mcp-ssh-orchestrator/tests
Sammy Farida 2182b00a1c feat: Add file size limits for YAML loading (PR4) (#28)
**Security Enhancement:** Prevent resource exhaustion attacks via oversized YAML files.

**Implementation:**
- Added MAX_YAML_FILE_SIZE constant (10MB) for configuration files
- Updated _load_yaml() to check file size before parsing
- Returns empty dict and logs security event if file exceeds limit
- Size validation prevents loading files into memory if too large

**Tests Added:**
- test_load_yaml_normal_size - Normal files load correctly
- test_load_yaml_oversized_file - Oversized files are rejected
- test_load_yaml_at_size_limit - Files at limit still load
- test_load_yaml_missing_file - Missing files return empty dict
- test_load_yaml_invalid_yaml - Invalid YAML handled gracefully
- test_load_yaml_empty_file - Empty files return empty dict

**Documentation:**
- Updated SECURITY.md with YAML file size limits section
- Updated Configuration.md with file size limit details
- Added security event logging examples

**Security Impact:** Prevents resource exhaustion attacks via maliciously
large YAML configuration files while allowing legitimate large configurations.

Fixes security vulnerability from CodeQL analysis.
2025-11-02 11:49:43 -05:00
..