UAT: SafetyProfile missing extra="forbid" — extra YAML fields silently ignored, masking configuration errors #5633

Open
opened 2026-04-09 07:59:42 +00:00 by HAL9000 · 1 comment
Owner

Summary

SafetyProfile does not have extra="forbid" in its Pydantic model_config, while AutomationProfile correctly uses extra="forbid". This inconsistency means that typos or unknown fields in a SafetyProfile YAML configuration are silently ignored rather than raising a validation error.

What Was Tested

Code-level analysis of:

  • src/cleveragents/domain/models/core/safety_profile.pySafetyProfile.model_config
  • src/cleveragents/domain/models/core/automation_profile.pyAutomationProfile.model_config

Expected Behavior

Both SafetyProfile and AutomationProfile should reject unknown fields with a clear validation error, since both are loaded from user-supplied YAML configuration files.

Actual Behavior

# safety_profile.py
model_config = ConfigDict(
    str_strip_whitespace=True,
    frozen=True,
    # Missing: extra="forbid"
)

# automation_profile.py
model_config = ConfigDict(
    str_strip_whitespace=True,
    validate_assignment=True,
    extra="forbid",  # Correctly rejects unknown fields
)

A user who writes:

safety:
  require_sandbox: true
  require_checkpoints: true
  allow_unsafe_toolz: false  # Typo: "toolz" instead of "tools"

Will get allow_unsafe_tools=False (the default) silently, with no error. The typo is invisible.

Impact

  • Configuration errors in SafetyProfile YAML are silently ignored
  • Users who mistype safety constraint field names get the default values instead of an error
  • This is particularly dangerous for security-critical fields like allow_unsafe_tools and require_sandbox

Code Location

  • src/cleveragents/domain/models/core/safety_profile.pySafetyProfile.model_config (line 233)

Fix Required

Add extra="forbid" to SafetyProfile.model_config:

model_config = ConfigDict(
    str_strip_whitespace=True,
    frozen=True,
    extra="forbid",  # Add this
)

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Summary `SafetyProfile` does not have `extra="forbid"` in its Pydantic `model_config`, while `AutomationProfile` correctly uses `extra="forbid"`. This inconsistency means that typos or unknown fields in a `SafetyProfile` YAML configuration are silently ignored rather than raising a validation error. ## What Was Tested Code-level analysis of: - `src/cleveragents/domain/models/core/safety_profile.py` — `SafetyProfile.model_config` - `src/cleveragents/domain/models/core/automation_profile.py` — `AutomationProfile.model_config` ## Expected Behavior Both `SafetyProfile` and `AutomationProfile` should reject unknown fields with a clear validation error, since both are loaded from user-supplied YAML configuration files. ## Actual Behavior ```python # safety_profile.py model_config = ConfigDict( str_strip_whitespace=True, frozen=True, # Missing: extra="forbid" ) # automation_profile.py model_config = ConfigDict( str_strip_whitespace=True, validate_assignment=True, extra="forbid", # Correctly rejects unknown fields ) ``` A user who writes: ```yaml safety: require_sandbox: true require_checkpoints: true allow_unsafe_toolz: false # Typo: "toolz" instead of "tools" ``` Will get `allow_unsafe_tools=False` (the default) silently, with no error. The typo is invisible. ## Impact - Configuration errors in `SafetyProfile` YAML are silently ignored - Users who mistype safety constraint field names get the default values instead of an error - This is particularly dangerous for security-critical fields like `allow_unsafe_tools` and `require_sandbox` ## Code Location - `src/cleveragents/domain/models/core/safety_profile.py` — `SafetyProfile.model_config` (line 233) ## Fix Required Add `extra="forbid"` to `SafetyProfile.model_config`: ```python model_config = ConfigDict( str_strip_whitespace=True, frozen=True, extra="forbid", # Add this ) ``` --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.5.0 milestone 2026-04-09 08:05:32 +00:00
Author
Owner

Label compliance fix applied:

  • Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md

Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: backlog-groomer

Label compliance fix applied: - Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: backlog-groomer
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.

Reference
cleveragents/cleveragents-core#5633
No description provided.