UAT: TUI shell danger detection missing 4 spec-required pattern categories — fdisk, parted, kill -9/killall, and standalone sudo/su #6819

Open
opened 2026-04-10 02:15:09 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

Feature Area: TUI — Shell Mode / Shell Danger Detection
Spec Reference: §TUI — Shell Danger Detection (pattern table)

Summary

The spec lists 7 categories of dangerous shell patterns. The current pattern_registry.py implementation is missing 4 of these spec-required pattern categories: fdisk/parted, kill -9/killall, standalone sudo/su, and > /dev/sda redirection. These omissions mean those commands bypass the danger detection system entirely.

Spec Requirements

From the specification's Shell Danger Detection section:

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)

What Was Found

File: src/cleveragents/tui/shell_safety/pattern_registry.py

Current patterns in DEFAULT_PATTERNS:

  • rm_rf_root, rm_rf_wildcard
  • chmod_777
  • dd_if_device ✓ (only half of the spec's > /dev/sda / dd if=> /dev/sda itself is missing)
  • fork_bomb
  • mkfs
  • chmod_recursive_permissive, shred_device, sudo_rm, wget/curl_pipe_sh/bash, git_push_force

Missing from spec table:

  1. fdisk — High risk (disk formatting, part of mkfs / fdisk / parted group in spec)
  2. parted — High risk (disk partitioning, same spec group)
  3. > /dev/sda redirect — High risk (raw device write, spec: > /dev/sda / dd if=)
  4. kill -9 / killall — Medium risk (process termination)
  5. Standalone sudo / su — Low risk (privilege escalation, spec says "warning only")

The existing sudo_rm pattern only catches sudo rm combinations (and at MEDIUM), not the standalone sudo or su commands the spec requires at LOW.

Impact

Commands like fdisk /dev/sda, parted /dev/sda, kill -9 1, killall python, sudo bash, and > /dev/sda execute with no warning whatsoever, silently bypassing danger detection.

Steps to Reproduce

  1. Read src/cleveragents/tui/shell_safety/pattern_registry.py
  2. Compare DEFAULT_PATTERNS against the spec table
  3. Check that fdisk, parted, kill -9, killall, and standalone sudo/su patterns are absent

Expected Behavior

All 7 pattern categories from the spec table should be implemented in DEFAULT_PATTERNS with the correct risk levels.


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

## Bug Report **Feature Area**: TUI — Shell Mode / Shell Danger Detection **Spec Reference**: §TUI — Shell Danger Detection (pattern table) ### Summary The spec lists 7 categories of dangerous shell patterns. The current `pattern_registry.py` implementation is missing 4 of these spec-required pattern categories: `fdisk`/`parted`, `kill -9`/`killall`, standalone `sudo`/`su`, and `> /dev/sda` redirection. These omissions mean those commands bypass the danger detection system entirely. ### Spec Requirements From the specification's Shell Danger Detection section: | 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) | ### What Was Found **File**: `src/cleveragents/tui/shell_safety/pattern_registry.py` Current patterns in `DEFAULT_PATTERNS`: - `rm_rf_root`, `rm_rf_wildcard` ✓ - `chmod_777` ✓ - `dd_if_device` ✓ (only half of the spec's `> /dev/sda / dd if=` — `> /dev/sda` itself is missing) - `fork_bomb` ✓ - `mkfs` ✓ - `chmod_recursive_permissive`, `shred_device`, `sudo_rm`, `wget/curl_pipe_sh/bash`, `git_push_force` **Missing from spec table:** 1. `fdisk` — High risk (disk formatting, part of `mkfs / fdisk / parted` group in spec) 2. `parted` — High risk (disk partitioning, same spec group) 3. `> /dev/sda` redirect — High risk (raw device write, spec: `> /dev/sda / dd if=`) 4. `kill -9` / `killall` — Medium risk (process termination) 5. Standalone `sudo` / `su` — Low risk (privilege escalation, spec says "warning only") The existing `sudo_rm` pattern only catches `sudo rm` combinations (and at MEDIUM), not the standalone `sudo` or `su` commands the spec requires at LOW. ### Impact Commands like `fdisk /dev/sda`, `parted /dev/sda`, `kill -9 1`, `killall python`, `sudo bash`, and `> /dev/sda` execute with no warning whatsoever, silently bypassing danger detection. ### Steps to Reproduce 1. Read `src/cleveragents/tui/shell_safety/pattern_registry.py` 2. Compare `DEFAULT_PATTERNS` against the spec table 3. Check that `fdisk`, `parted`, `kill -9`, `killall`, and standalone `sudo`/`su` patterns are absent ### Expected Behavior All 7 pattern categories from the spec table should be implemented in `DEFAULT_PATTERNS` with the correct risk levels. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.7.0 milestone 2026-04-10 02:15:09 +00:00
HAL9000 self-assigned this 2026-04-10 06:07:52 +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.

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