action: from_yaml_file() has no file size limit #10542

Open
opened 2026-04-18 17:07:27 +00:00 by HAL9000 · 0 comments
Owner

Metadata

  • Commit: Current HEAD
  • Branch: main
  • File: src/cleveragents/action/schema.py
  • Lines: 376-381

Background and Context

The from_yaml_file() method reads entire YAML files into memory without enforcing a size limit. If a user provides a path to a very large file (e.g., 1GB), it could cause an out-of-memory error. This is a potential denial-of-service vulnerability if the file path is user-controlled.

Expected Behavior

The from_yaml_file() method should enforce a reasonable file size limit before reading the file. Files exceeding the limit should be rejected with a clear error message.

Acceptance Criteria

  • from_yaml_file() enforces a maximum file size limit
  • Reasonable default limit is set (e.g., 10MB)
  • Files exceeding the limit raise an error with clear message
  • Limit is configurable via parameter or constant
  • Existing tests pass with size limit added
  • New tests verify size limit enforcement

Subtasks

  • Define reasonable maximum file size constant
  • Add file size check before reading file content
  • Check file size using filepath.stat().st_size
  • Raise clear error if file exceeds limit
  • Make limit configurable (optional parameter)
  • Add test cases for files at, below, and above limit

Definition of Done

  • from_yaml_file() enforces file size limit
  • Large files are rejected before reading
  • Error messages are clear
  • All tests pass
  • Code review approved

Automated by CleverAgents Bot
Agent: new-issue-creator

## Metadata - **Commit**: Current HEAD - **Branch**: main - **File**: src/cleveragents/action/schema.py - **Lines**: 376-381 ## Background and Context The from_yaml_file() method reads entire YAML files into memory without enforcing a size limit. If a user provides a path to a very large file (e.g., 1GB), it could cause an out-of-memory error. This is a potential denial-of-service vulnerability if the file path is user-controlled. ## Expected Behavior The from_yaml_file() method should enforce a reasonable file size limit before reading the file. Files exceeding the limit should be rejected with a clear error message. ## Acceptance Criteria - [ ] from_yaml_file() enforces a maximum file size limit - [ ] Reasonable default limit is set (e.g., 10MB) - [ ] Files exceeding the limit raise an error with clear message - [ ] Limit is configurable via parameter or constant - [ ] Existing tests pass with size limit added - [ ] New tests verify size limit enforcement ## Subtasks - [ ] Define reasonable maximum file size constant - [ ] Add file size check before reading file content - [ ] Check file size using filepath.stat().st_size - [ ] Raise clear error if file exceeds limit - [ ] Make limit configurable (optional parameter) - [ ] Add test cases for files at, below, and above limit ## Definition of Done - from_yaml_file() enforces file size limit - Large files are rejected before reading - Error messages are clear - All tests pass - Code review approved --- **Automated by CleverAgents Bot** Agent: new-issue-creator
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
cleveragents/cleveragents-core#10542
No description provided.