BUG-HUNT: [security] Path traversal vulnerability in from_yaml_file #1768

Open
opened 2026-04-02 23:46:12 +00:00 by freemo · 2 comments
Owner

Metadata

  • Branch: fix/security-path-traversal-action-schema-from-yaml-file
  • Commit Message: fix(action): validate resolved path is within trusted root in ActionConfigSchema.from_yaml_file
  • Milestone: v3.6.0
  • Parent Epic: #400

Background and Context

The from_yaml_file method in ActionConfigSchema (src/cleveragents/action/schema.py, lines 380–412) accepts a caller-supplied file path and reads it without any boundary validation. An attacker who can influence the path argument (e.g. via a crafted config value or API input) can supply a path such as ../../../../etc/passwd to read arbitrary files accessible to the process owner.

Subtasks

  • Resolve the supplied path to its absolute, canonical form using Path.resolve() before any file I/O
  • Define (or accept as a parameter) a trusted root directory (e.g. the project root or a designated config directory)
  • Raise a ValueError (or a dedicated SecurityError) when the resolved path does not start with the trusted root
  • Add unit tests covering: a valid path inside the trusted root, a path using .. traversal, an absolute path outside the root, and a symlink that escapes the root
  • Update docstring of from_yaml_file to document the trusted-root constraint
  • Ensure all nox stages pass with the new validation in place

Definition of Done

  • ActionConfigSchema.from_yaml_file resolves the input path and rejects any path that escapes the trusted root directory
  • A clear, descriptive exception is raised on traversal attempts (no silent failures)
  • Unit tests cover all traversal vectors (relative .., absolute out-of-root, symlink escape)
  • No regression in existing tests for valid paths
  • All nox stages pass
  • Coverage >= 97%

Automated by CleverAgents Bot
Supervisor: Bug Hunting | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/security-path-traversal-action-schema-from-yaml-file` - **Commit Message**: `fix(action): validate resolved path is within trusted root in ActionConfigSchema.from_yaml_file` - **Milestone**: v3.6.0 - **Parent Epic**: #400 ## Background and Context The `from_yaml_file` method in `ActionConfigSchema` (`src/cleveragents/action/schema.py`, lines 380–412) accepts a caller-supplied file path and reads it without any boundary validation. An attacker who can influence the path argument (e.g. via a crafted config value or API input) can supply a path such as `../../../../etc/passwd` to read arbitrary files accessible to the process owner. ## Subtasks - [ ] Resolve the supplied path to its absolute, canonical form using `Path.resolve()` before any file I/O - [ ] Define (or accept as a parameter) a trusted root directory (e.g. the project root or a designated config directory) - [ ] Raise a `ValueError` (or a dedicated `SecurityError`) when the resolved path does not start with the trusted root - [ ] Add unit tests covering: a valid path inside the trusted root, a path using `..` traversal, an absolute path outside the root, and a symlink that escapes the root - [ ] Update docstring of `from_yaml_file` to document the trusted-root constraint - [ ] Ensure all nox stages pass with the new validation in place ## Definition of Done - [ ] `ActionConfigSchema.from_yaml_file` resolves the input path and rejects any path that escapes the trusted root directory - [ ] A clear, descriptive exception is raised on traversal attempts (no silent failures) - [ ] Unit tests cover all traversal vectors (relative `..`, absolute out-of-root, symlink escape) - [ ] No regression in existing tests for valid paths - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: Bug Hunting | Agent: ca-new-issue-creator
freemo added this to the v3.6.0 milestone 2026-04-02 23:46:44 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Priority/High
  • MoSCoW: MoSCoW/Must Have — path traversal vulnerability in from_yaml_file is a security issue. Must Have.

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: Priority/High - **MoSCoW**: MoSCoW/Must Have — path traversal vulnerability in `from_yaml_file` is a security issue. Must Have. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Critical — This is a security vulnerability. Path traversal in from_yaml_file could allow reading arbitrary files on the filesystem. This is a data exposure risk.
  • Milestone: v3.6.0 — Keeping in v3.6.0 where security hardening is scoped. However, this should be prioritized above all other v3.6.0 work.
  • MoSCoW: Must Have — Security vulnerabilities are always Must Have. The specification mandates safety and security as core principles.
  • Parent Epic: #400 (Post-MVP Security) — Path traversal is a security issue.

Recommendation: This issue should be picked up immediately. Elevating to Priority/Critical.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: Critical — **This is a security vulnerability.** Path traversal in `from_yaml_file` could allow reading arbitrary files on the filesystem. This is a data exposure risk. - **Milestone**: v3.6.0 — Keeping in v3.6.0 where security hardening is scoped. However, this should be prioritized above all other v3.6.0 work. - **MoSCoW**: Must Have — Security vulnerabilities are always Must Have. The specification mandates safety and security as core principles. - **Parent Epic**: #400 (Post-MVP Security) — Path traversal is a security issue. **Recommendation:** This issue should be picked up immediately. Elevating to Priority/Critical. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
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.

Blocks
#400 Epic: Post-MVP Security
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#1768
No description provided.