action: Environment variable interpolation doesn't validate YAML structure #10543

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

Metadata

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

Background and Context

The _interpolate_env_vars() function replaces ${VAR} references with environment variable values without validating that the result is valid YAML. If an environment variable contains YAML special characters (colons, quotes, newlines, etc.), the interpolated value could break the YAML structure, creating invalid YAML that silently fails or produces unexpected results.

Expected Behavior

Environment variable values should be properly escaped or quoted when interpolated into YAML to ensure the resulting YAML remains valid. The interpolation should either escape special characters or wrap values in quotes.

Acceptance Criteria

  • Environment variable values are properly escaped/quoted in YAML
  • Special characters in env vars don't break YAML structure
  • Resulting YAML is valid after interpolation
  • Existing tests pass with escaping added
  • New tests verify YAML validity after interpolation with special chars

Subtasks

  • Review YAML special characters that need escaping
  • Implement proper escaping or quoting for env var values
  • Consider using YAML library functions for safe value insertion
  • Add test cases with special characters in env vars
  • Verify YAML validity after interpolation
  • Document escaping behavior for users

Definition of Done

  • Environment variable interpolation produces valid YAML
  • Special characters in env vars are handled safely
  • 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**: 393-398 ## Background and Context The _interpolate_env_vars() function replaces ${VAR} references with environment variable values without validating that the result is valid YAML. If an environment variable contains YAML special characters (colons, quotes, newlines, etc.), the interpolated value could break the YAML structure, creating invalid YAML that silently fails or produces unexpected results. ## Expected Behavior Environment variable values should be properly escaped or quoted when interpolated into YAML to ensure the resulting YAML remains valid. The interpolation should either escape special characters or wrap values in quotes. ## Acceptance Criteria - [ ] Environment variable values are properly escaped/quoted in YAML - [ ] Special characters in env vars don't break YAML structure - [ ] Resulting YAML is valid after interpolation - [ ] Existing tests pass with escaping added - [ ] New tests verify YAML validity after interpolation with special chars ## Subtasks - [ ] Review YAML special characters that need escaping - [ ] Implement proper escaping or quoting for env var values - [ ] Consider using YAML library functions for safe value insertion - [ ] Add test cases with special characters in env vars - [ ] Verify YAML validity after interpolation - [ ] Document escaping behavior for users ## Definition of Done - Environment variable interpolation produces valid YAML - Special characters in env vars are handled safely - 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#10543
No description provided.