safe-find
Safe wrappers for find and fd commands that block dangerous execution
options.
๐ ๆฅๆฌ่ช็ README
๐ Quick Start
# Install both tools (361KB each!)
# Use just like normal find/fd commands
๐ Why safe-find?
The standard find and fd commands have powerful but dangerous options that
can execute arbitrary commands:
# โ ๏ธ DANGEROUS - Can execute any command
# โ
SAFE - Dangerous options are blocked
๐ก๏ธ Blocked Options
safe-find blocks:
-exec- Execute arbitrary commands-execdir- Execute commands in file's directory-ok- Interactive command execution-okdir- Interactive command execution in file's directory-delete- Delete matched files/directories
safe-fd blocks:
-x,--exec- Execute arbitrary commands-X,--exec-batch- Batch command execution-l,--list-details- Useslsinternally (potential risk)
๐ฆ Installation
Prerequisites
- Rust (for building from source) or just use pre-built binaries
Install from Crates.io (Recommended)
# Install both safe-find and safe-fd
Install from Source
Pre-built Binaries
Download platform-specific binaries (361KB each) from GitHub Releases.
๐ง Usage
safe-find
All safe find options work exactly the same:
# Find TypeScript files
# Find large log files
# Find recently modified files
# Complex searches
safe-fd
All safe fd options work exactly the same:
# Find JavaScript files
# Find files with glob pattern
# Search in specific directory
# Case insensitive search
โก Performance
Extremely lightweight and fast:
- Binary size: Only 361KB each (98.3% smaller than Deno version)
- Zero dependencies: No external libraries required
- Instant startup: Near-zero overhead compared to native commands
- Memory efficient: Minimal memory footprint
๐งช Example Output
๐ ๏ธ Development
# Clone repository
# Run tests
# Check formatting
# Run linter
# Build debug version
# Build optimized release version
# Test locally
๐ Use Cases
๐ค LLM/AI Tools (Primary Use Case)
The most important use case is providing safe file search capabilities to AI tools like Claude Code, ChatGPT Code Interpreter, and other LLM-based development assistants.
AI models often need to search and analyze file systems, but giving them access to dangerous execution commands poses significant security risks. safe-find and safe-fd provide the perfect solution - full search functionality without execution capabilities.
Claude Code Integration
Add this to your project's CLAUDE.md file to enable safe file operations:
`cargo install safe-find`
Add to your `.claude/settings.local.json`:
{ "permissions": { "allow": [ "Bash(safe-find:_)", "Bash(safe-fd:_)" ], "deny":
[ "Bash(find:_)", "Bash(fd:_)" ] } }
Use `safe-fd` when fd is available, or `safe-find` when fd is not installed.
Both tools block dangerous execution options while providing safe file search
functionality.
Basic search examples:
- -
Benefits for AI Development:
- Security: Prevents accidental file deletion or command execution
- Functionality: Maintains all search and filtering capabilities
- Performance: Zero overhead for search operations
- Trust: Allows confident delegation of file system tasks to AI
- Compliance: Meets security requirements for automated development environments
๐ ๏ธ Other Use Cases
- CI/CD pipelines: Prevent accidental command execution in automated scripts
- Shared servers: Allow file search without execution risks
- Security-conscious environments: Maintain find/fd functionality while blocking dangerous operations
- Teaching environments: Safe way to learn find/fd without execution risks
- Development containers: Secure file operations in containerized development environments
๐ License
MIT License
๐ Links
Project Links
Original Commands
- find command - GNU findutils documentation
- fd command - A simple, fast and user-friendly alternative to find
โญ Show Your Support
Give a โญ๏ธ if this project helped you stay safe while using find/fd commands!