UAT: Shell danger detection missing > /dev/sda device redirect pattern (should be CRITICAL) #10424

Open
opened 2026-04-18 09:37:29 +00:00 by HAL9000 · 0 comments
Owner

Summary

The spec requires > /dev/sda (redirect to block device) to be detected at CRITICAL danger level. This pattern is absent from the default pattern registry.

Expected Behavior (from spec)

> /dev/sda → CRITICAL danger level

Actual Behavior

src/cleveragents/tui/shell_safety/pattern_registry.py has no pattern matching output redirection to block devices (> /dev/sda, > /dev/sdb, etc.).

The closest pattern is dd_if_device (HIGH) which matches dd if=, but does not match shell redirection syntax like echo "" > /dev/sda.

Reproduction Steps

  1. Inspect src/cleveragents/tui/shell_safety/pattern_registry.py
  2. Search for /dev/sda or redirect patterns — none found
  3. Run DangerousPatternDetector().check("echo '' > /dev/sda") — returns no warnings
  4. Per spec, this should be CRITICAL

Subtasks

  • Add pattern matching > /dev/sd[a-z] and > /dev/nvme at CRITICAL level
  • Also cover >> /dev/sd[a-z] (append redirect)
  • Add tests for device redirect patterns
  • Verify existing tests still pass

Definition of Done

  • echo "" > /dev/sda detected at CRITICAL
  • cat file > /dev/sdb detected at CRITICAL
  • Tests pass

Automated by CleverAgents Bot
Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor

## Summary The spec requires `> /dev/sda` (redirect to block device) to be detected at CRITICAL danger level. This pattern is absent from the default pattern registry. ## Expected Behavior (from spec) `> /dev/sda` → CRITICAL danger level ## Actual Behavior `src/cleveragents/tui/shell_safety/pattern_registry.py` has no pattern matching output redirection to block devices (`> /dev/sda`, `> /dev/sdb`, etc.). The closest pattern is `dd_if_device` (HIGH) which matches `dd if=`, but does not match shell redirection syntax like `echo "" > /dev/sda`. ## Reproduction Steps 1. Inspect `src/cleveragents/tui/shell_safety/pattern_registry.py` 2. Search for `/dev/sda` or redirect patterns — none found 3. Run `DangerousPatternDetector().check("echo '' > /dev/sda")` — returns no warnings 4. Per spec, this should be CRITICAL ## Subtasks - [ ] Add pattern matching `> /dev/sd[a-z]` and `> /dev/nvme` at CRITICAL level - [ ] Also cover `>> /dev/sd[a-z]` (append redirect) - [ ] Add tests for device redirect patterns - [ ] Verify existing tests still pass ## Definition of Done - [ ] `echo "" > /dev/sda` detected at CRITICAL - [ ] `cat file > /dev/sdb` detected at CRITICAL - [ ] Tests pass --- **Automated by CleverAgents Bot** Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor
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#10424
No description provided.