UAT: AutomationGuard allows overlapping tool_allowlist and tool_denylist without validation warning — silent precedence ambiguity #5642

Open
opened 2026-04-09 08:03:27 +00:00 by HAL9000 · 1 comment
Owner

Summary

AutomationGuard accepts configurations where the same tool name appears in both tool_allowlist and tool_denylist without raising a validation error or warning. The denylist silently takes precedence (checked first in check_guard()), but this behavior is not documented and could confuse users who expect allowlist to override denylist.

What Was Tested

Code-level analysis of:

  • src/cleveragents/domain/models/core/automation_guard.pyAutomationGuard model validators
  • src/cleveragents/domain/models/core/automation_profile.pycheck_guard() evaluation order

Expected Behavior

When a tool appears in both tool_allowlist and tool_denylist, the system should either:

  1. Raise a ValueError at configuration time (preferred — fail fast), OR
  2. Log a warning that the denylist takes precedence

Actual Behavior

# This is accepted without error or warning:
guard = AutomationGuard(
    tool_allowlist=["read_file", "write_file"],
    tool_denylist=["write_file"],  # write_file is in BOTH lists
)
# check_guard("write_file", ...) → denied (denylist checked first)
# check_guard("read_file", ...) → allowed (not in denylist, is in allowlist)
# No warning that write_file is in both lists

The check_guard() evaluation order (denylist → allowlist) means denylist always wins, but this is not validated at configuration time.

Impact

  • Users who configure overlapping allowlist/denylist get surprising behavior with no diagnostic
  • A tool that should be allowed (on allowlist) is silently blocked because it's also on the denylist
  • Configuration errors are invisible until runtime

Code Location

  • src/cleveragents/domain/models/core/automation_guard.pyAutomationGuard class (no cross-field validator for list overlap)

Fix Required

Add a model_validator to AutomationGuard that checks for overlap between tool_allowlist and tool_denylist:

@model_validator(mode="after")
def _check_list_overlap(self) -> AutomationGuard:
    if self.tool_allowlist is not None and self.tool_denylist is not None:
        overlap = set(self.tool_allowlist) & set(self.tool_denylist)
        if overlap:
            raise ValueError(
                f"Tools appear in both allowlist and denylist (denylist takes precedence): "
                f"{sorted(overlap)}"
            )
    return self

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

## Summary `AutomationGuard` accepts configurations where the same tool name appears in both `tool_allowlist` and `tool_denylist` without raising a validation error or warning. The denylist silently takes precedence (checked first in `check_guard()`), but this behavior is not documented and could confuse users who expect allowlist to override denylist. ## What Was Tested Code-level analysis of: - `src/cleveragents/domain/models/core/automation_guard.py` — `AutomationGuard` model validators - `src/cleveragents/domain/models/core/automation_profile.py` — `check_guard()` evaluation order ## Expected Behavior When a tool appears in both `tool_allowlist` and `tool_denylist`, the system should either: 1. Raise a `ValueError` at configuration time (preferred — fail fast), OR 2. Log a warning that the denylist takes precedence ## Actual Behavior ```python # This is accepted without error or warning: guard = AutomationGuard( tool_allowlist=["read_file", "write_file"], tool_denylist=["write_file"], # write_file is in BOTH lists ) # check_guard("write_file", ...) → denied (denylist checked first) # check_guard("read_file", ...) → allowed (not in denylist, is in allowlist) # No warning that write_file is in both lists ``` The `check_guard()` evaluation order (denylist → allowlist) means denylist always wins, but this is not validated at configuration time. ## Impact - Users who configure overlapping allowlist/denylist get surprising behavior with no diagnostic - A tool that should be allowed (on allowlist) is silently blocked because it's also on the denylist - Configuration errors are invisible until runtime ## Code Location - `src/cleveragents/domain/models/core/automation_guard.py` — `AutomationGuard` class (no cross-field validator for list overlap) ## Fix Required Add a `model_validator` to `AutomationGuard` that checks for overlap between `tool_allowlist` and `tool_denylist`: ```python @model_validator(mode="after") def _check_list_overlap(self) -> AutomationGuard: if self.tool_allowlist is not None and self.tool_denylist is not None: overlap = set(self.tool_allowlist) & set(self.tool_denylist) if overlap: raise ValueError( f"Tools appear in both allowlist and denylist (denylist takes precedence): " f"{sorted(overlap)}" ) return self ``` --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.5.0 milestone 2026-04-09 08:05:31 +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#5642
No description provided.