elizaOS Shell Plugin (Rust)
A secure shell command execution library for elizaOS that allows executing terminal commands within a restricted directory with command history tracking.
Installation
Add to your Cargo.toml:
[]
= "1.2.0"
Features
- Cross-platform support: Works on Linux, macOS, and Windows
- Directory restriction: Commands are restricted to a specified directory for safety
- Command filtering: Configurable list of forbidden commands
- Timeout protection: Automatic termination of long-running commands
- Command history: Tracks command execution history per conversation
- File operation tracking: Monitors file creation, modification, and deletion
- Type safe: Full Rust type safety with comprehensive error handling
Usage
use ;
async
Configuration
The plugin can be configured via environment variables:
SHELL_ALLOWED_DIRECTORY: Directory to restrict commands toSHELL_TIMEOUT: Command timeout in milliseconds (default: 30000)SHELL_FORBIDDEN_COMMANDS: Comma-separated list of forbidden commands
Security
The plugin enforces several security measures:
- Directory Restriction: All commands execute within the allowed directory
- Forbidden Commands: Dangerous commands are blocked by default
- Path Traversal Protection: Blocks
../and similar patterns - No Shell Expansion: Commands execute without dangerous shell interpretation
- Timeout Protection: Commands auto-terminate after timeout
License
MIT