Refactor: Remove security module and related functionality

- Deleted the `security` module and its associated files, including `daemon.rs` and `install.rs`.
- Removed references to security features in various modules, including `mod.rs`, `mode/mod.rs`, and `input.rs`.
- Updated the `MiscState` struct to eliminate security-related fields.
- Adjusted the `apply_action` function to remove security action handling.
- Increased the maximum limits for tool-only turns and agent steps in `actions/mod.rs`.
- Modified the review prompt to exclude security checks.
- Cleaned up the `git_operator` and `shell` tools to remove catastrophic guard checks.
- Removed internet-related tools and their references from the tool module.
This commit is contained in:
asepharyana
2026-07-12 03:56:43 +07:00
parent 4bfbe1d1b9
commit a974118b5a
39 changed files with 79 additions and 2175 deletions
+4 -61
View File
@@ -1,8 +1,8 @@
# Zesdex
> Autonomous AI coding and security agent in a terminal-based TUI.
> Autonomous AI coding agent in a terminal-based TUI.
Zesdex is a Rust-powered AI assistant that operates directly in your terminal via a rich TUI interface. It combines large language model intelligence with a comprehensive set of tools to explore, understand, and modify codebases autonomously — with built-in security guardrails at every layer.
Zesdex is a Rust-powered AI assistant that operates directly in your terminal via a rich TUI interface. It combines large language model intelligence with a comprehensive set of tools to explore, understand, and modify codebases autonomously — with built-in guardrails at every layer.
---
@@ -21,9 +21,8 @@ Zesdex is a Rust-powered AI assistant that operates directly in your terminal vi
|----------|-------|
| **Filesystem** | `read`, `write`, `edit`, `delete` |
| **Search** | `grep` (recursive text), `glob` (file patterns) |
| **Shell** | `bash` (with catastrophic guard), `bash_output`, `bash_kill` |
| **Shell** | `bash`, `bash_output`, `bash_kill` |
| **Git** | `git_operator`, `git_worktree`, `git_cred` |
| **Internet** | `fetch` (URL→markdown), `download`, `web_search` |
| **Memory** | `remember`, `recall`, `forget` |
| **Planning** | `plan_enter`, `plan_ready`, `seqthink` |
| **Workflow** | `workflow_run`, `note_finding` |
@@ -37,14 +36,8 @@ Zesdex is a Rust-powered AI assistant that operates directly in your terminal vi
- **MCP Support** — [Model Context Protocol](https://modelcontextprotocol.io/) integration for connecting to external AI tool servers.
- **Sequential Thinking** — Chain-of-thought reasoning tool for step-by-step problem decomposition.
### Security
- **Catastrophic Guard** — Detects and blocks destructive operations (`rm -rf`, `force push`, credential exfiltration) across all tool invocations.
- **Graduated Checks** — Content-aware pattern matching for common danger zones (API keys, passwords, git credentials) with configurable rules.
- **Risky Tool Classification** — Write, delete, edit, bash, and git operations are flagged for additional scrutiny.
- **Workspace Isolation** — All file operations are validated against workspace roots. Path traversal outside the workspace is rejected.
- **Session Locking** — Prevents multiple processes from operating on the same session directory.
- **Security Sidecar** — Optional Python daemon for deep vulnerability scanning (see below).
### Session Management
@@ -54,36 +47,6 @@ Zesdex is a Rust-powered AI assistant that operates directly in your terminal vi
---
## Security Sidecar
An optional Python-based companion daemon that provides security analysis tools beyond what the core Rust binary offers.
### Available Tools
| Category | Tools | Required Binary |
|----------|-------|-----------------|
| **Web Security** | `sqlmap`, `nuclei`, `ffuf`, `dalfox`, `zap`, `xss_confirm`, `http` | sqlmap, nuclei, ffuf, dalfox, zap-cli, curl |
| **Cryptography** | `z3`, `sage`, `rsa`, `factordb`, `hashcat`, `hashid`, `decode` | z3, sage, hashcat, hashid |
| **Reverse Engineering** | `js_deobfuscate`, `sourcemap`, `wasm_decompile` | npx, wasm-decompile |
| **Binary Exploitation** | `triage`, `ropgadget`, `pwntools`, `exploit_template` | file, checksec, ROPgadget, python3 |
### Installation
```bash
pip install -r security-sidecar/requirements.txt
# Optional: install full extras for crypto/pwn tools
pip install -r security-sidecar/requirements.txt[full]
```
### Health Check
```bash
python -m zesdex_sec_daemon --health
```
---
## Architecture
```
@@ -106,11 +69,9 @@ src/
│ ├── harness.rs # Tool harness for agent execution
│ ├── workflow/ # Workflow engine (script DSL, executor)
│ ├── mcp/ # MCP client manager
│ ├── sec/ # Security sidecar integration
│ ├── subagent/ # Sub-agent spawn, context, events
│ ├── bgbash/ # Background bash job management
│ ├── review/ # Self-review quality system
│ └── catastrophic.rs # Catastrophic operation detection
├── controller/
│ ├── input.rs # Key event → Action mapping
│ └── command.rs # Slash command parser
@@ -135,20 +96,17 @@ src/
│ ├── msglog/ # Message log (SQLite-backed)
│ ├── agent_def/ # Agent definitions (builtin, global, session)
│ └── session_lock.rs # Flock-based session locking
├── security/
│ └── install.rs # Sidecar binary management
├── service/
│ ├── provider.rs # AI provider abstraction
│ └── oauth/ # OAuth PKCE flow with loopback server
├── tool/ # 28 tool implementations
│ ├── fs/ # read, write, edit, delete
│ ├── search.rs # grep, glob
│ ├── shell.rs # bash (with catastrophic guard)
│ ├── shell.rs # bash
│ ├── bash_tools.rs # bash_output, bash_kill
│ ├── git_operator.rs # git operations
│ ├── git_worktree.rs # git worktree management
│ ├── git_cred.rs # git credential store/get/erase
│ ├── internet/ # fetch, download, web_search
│ ├── memory/ # remember, forget, recall
│ ├── plan.rs # plan_enter, plan_ready
│ ├── seqthink.rs # Sequential thinking
@@ -189,7 +147,6 @@ RUST_LOG=debug zesdex
| `Ctrl+Q` | Quit |
| `Ctrl+H` | Help overlay |
| `Ctrl+P` | Settings overlay |
| `Ctrl+A` | Toggle yolo arm |
| `Ctrl+B` | Bash panel |
| `Ctrl+S` | Session hub |
| `Ctrl+T` | Task list |
@@ -223,7 +180,6 @@ All configuration lives in `~/.config/zesdex/` (or platform equivalent via the `
| `app_config.json` | AI provider definitions (name, API base URL, auth type, default model) |
| `memory/` | Persistent lesson and reference storage (Markdown with YAML frontmatter) |
| `sessions/` | Per-session transcripts, edit logs, and activity data |
| `bin/` | Security sidecar binary |
| `run/` | Unix domain sockets for daemon mode |
### Provider Configuration
@@ -258,7 +214,6 @@ Key settings in `settings.json`:
| Setting | Default | Description |
|---------|---------|-------------|
| `internet_mode` | `Off` | `Off`, `ReadOnly`, or `Full` |
| `review_enabled` | `true` | Enable self-review after tool execution |
| `review_max_lessons_per_run` | `5` | Max lessons loaded per review cycle |
| `adaptive_review_max_skip` | `3` | Consecutive passes before skipping review |
@@ -273,7 +228,6 @@ Key settings in `settings.json`:
### Prerequisites
- **Rust** 2021 edition toolchain ([rustup](https://rustup.rs/))
- **Python 3** (optional, for the security sidecar)
### Build from Source
@@ -284,17 +238,6 @@ cargo build --release
./target/release/zesdex
```
### Security Sidecar (Optional)
```bash
pip install -r security-sidecar/requirements.txt
```
For full crypto and pwn tool support:
```bash
pip install pycryptodome factordb-python pwntools ropper
```
---