UAT: TUI shell danger detection missing spec-required patterns — kill -9, fdisk/parted, sudo/su, and > /dev/sda patterns absent from DEFAULT_PATTERNS #4796

Open
opened 2026-04-08 18:59:57 +00:00 by HAL9000 · 1 comment
Owner

Bug Report

Feature Area: TUI Shell Danger Detection
Severity: Medium (backlog)
Found by: UAT tester instance uat-tui-worker-1
Spec reference: docs/specification.md §Shell Danger Detection (lines ~30049–30062)


What Was Tested

The src/cleveragents/tui/shell_safety/pattern_registry.py DEFAULT_PATTERNS was compared against the spec's required patterns.

Expected Behavior (from spec)

The spec defines these shell danger patterns:

Pattern Risk Level Example
rm -rf / rm -r High rm -rf /
chmod 777 Medium chmod 777 /var/www
> /dev/sda / dd if= High dd if=/dev/zero of=/dev/sda
:(){ :|:& };: (fork bomb) High Fork bomb patterns
mkfs / fdisk / parted High Disk formatting tools
kill -9 / killall Medium Process termination
sudo / su Low Privilege escalation (warning only)

Actual Behavior

The DEFAULT_PATTERNS in pattern_registry.py contains:

Present (correct):

  • rm_rf_root (CRITICAL) ✓
  • rm_rf_wildcard (CRITICAL) ✓
  • fork_bomb (CRITICAL) ✓
  • dd_if_device (HIGH) ✓
  • mkfs (HIGH) ✓
  • shred_device (HIGH) ✓
  • chmod_777 (MEDIUM) ✓
  • sudo_rm (MEDIUM) ✓
  • wget_pipe_sh / curl_pipe_sh / wget_pipe_bash / curl_pipe_bash (MEDIUM) ✓
  • git_push_force (LOW) ✓
  • chmod_recursive_permissive (LOW) ✓

Missing (spec-required):

  1. fdisk / parted — HIGH risk (disk partitioning tools)
  2. kill -9 / killall — MEDIUM risk (process termination)
  3. sudo / su (standalone, not just sudo rm) — LOW risk (privilege escalation warning)
  4. > /dev/sda (redirect to device) — HIGH risk

Code Location

  • Registry: src/cleveragents/tui/shell_safety/pattern_registry.pyDEFAULT_PATTERNS tuple
  • Fix: Add the four missing pattern groups to DEFAULT_PATTERNS

Steps to Reproduce

from cleveragents.tui.shell_safety.pattern_detector import DangerousPatternDetector
detector = DangerousPatternDetector()

# These should be detected but aren't:
print(detector.is_dangerous("fdisk /dev/sda"))   # False — should be True (HIGH)
print(detector.is_dangerous("parted /dev/sda"))  # False — should be True (HIGH)
print(detector.is_dangerous("kill -9 1234"))     # False — should be True (MEDIUM)
print(detector.is_dangerous("killall python"))   # False — should be True (MEDIUM)
print(detector.is_dangerous("sudo bash"))        # False — should be True (LOW)
print(detector.is_dangerous("su root"))          # False — should be True (LOW)

Impact

  • fdisk and parted commands are not flagged as dangerous
  • kill -9 and killall are not flagged
  • sudo (without rm) is not flagged as a privilege escalation warning
  • The spec's danger detection coverage is incomplete

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

## Bug Report **Feature Area:** TUI Shell Danger Detection **Severity:** Medium (backlog) **Found by:** UAT tester instance `uat-tui-worker-1` **Spec reference:** docs/specification.md §Shell Danger Detection (lines ~30049–30062) --- ### What Was Tested The `src/cleveragents/tui/shell_safety/pattern_registry.py` `DEFAULT_PATTERNS` was compared against the spec's required patterns. ### Expected Behavior (from spec) The spec defines these shell danger patterns: | Pattern | Risk Level | Example | |---------|-----------|---------| | `rm -rf` / `rm -r` | High | `rm -rf /` | | `chmod 777` | Medium | `chmod 777 /var/www` | | `> /dev/sda` / `dd if=` | High | `dd if=/dev/zero of=/dev/sda` | | `:(){ :\|:& };:` (fork bomb) | High | Fork bomb patterns | | `mkfs` / `fdisk` / `parted` | High | Disk formatting tools | | `kill -9` / `killall` | Medium | Process termination | | `sudo` / `su` | Low | Privilege escalation (warning only) | ### Actual Behavior The `DEFAULT_PATTERNS` in `pattern_registry.py` contains: **Present (correct):** - `rm_rf_root` (CRITICAL) ✓ - `rm_rf_wildcard` (CRITICAL) ✓ - `fork_bomb` (CRITICAL) ✓ - `dd_if_device` (HIGH) ✓ - `mkfs` (HIGH) ✓ - `shred_device` (HIGH) ✓ - `chmod_777` (MEDIUM) ✓ - `sudo_rm` (MEDIUM) ✓ - `wget_pipe_sh` / `curl_pipe_sh` / `wget_pipe_bash` / `curl_pipe_bash` (MEDIUM) ✓ - `git_push_force` (LOW) ✓ - `chmod_recursive_permissive` (LOW) ✓ **Missing (spec-required):** 1. `fdisk` / `parted` — HIGH risk (disk partitioning tools) 2. `kill -9` / `killall` — MEDIUM risk (process termination) 3. `sudo` / `su` (standalone, not just `sudo rm`) — LOW risk (privilege escalation warning) 4. `> /dev/sda` (redirect to device) — HIGH risk ### Code Location - **Registry:** `src/cleveragents/tui/shell_safety/pattern_registry.py` — `DEFAULT_PATTERNS` tuple - **Fix:** Add the four missing pattern groups to `DEFAULT_PATTERNS` ### Steps to Reproduce ```python from cleveragents.tui.shell_safety.pattern_detector import DangerousPatternDetector detector = DangerousPatternDetector() # These should be detected but aren't: print(detector.is_dangerous("fdisk /dev/sda")) # False — should be True (HIGH) print(detector.is_dangerous("parted /dev/sda")) # False — should be True (HIGH) print(detector.is_dangerous("kill -9 1234")) # False — should be True (MEDIUM) print(detector.is_dangerous("killall python")) # False — should be True (MEDIUM) print(detector.is_dangerous("sudo bash")) # False — should be True (LOW) print(detector.is_dangerous("su root")) # False — should be True (LOW) ``` ### Impact - `fdisk` and `parted` commands are not flagged as dangerous - `kill -9` and `killall` are not flagged - `sudo` (without `rm`) is not flagged as a privilege escalation warning - The spec's danger detection coverage is incomplete --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Medium — spec compliance bug identified by UAT testing
  • Story Points: 3 (M) — targeted fix to align implementation with spec
  • MoSCoW: Must Have — spec compliance is required for correct system behavior

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: Medium — spec compliance bug identified by UAT testing - **Story Points**: 3 (M) — targeted fix to align implementation with spec - **MoSCoW**: Must Have — spec compliance is required for correct system behavior --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner
HAL9000 added this to the v3.7.0 milestone 2026-04-09 03:03:39 +00:00
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#4796
No description provided.