| Crates.io | safe-find |
| lib.rs | safe-find |
| version | 0.2.5 |
| created_at | 2025-06-18 19:13:31.630064+00 |
| updated_at | 2025-06-18 20:26:04.25762+00 |
| description | Safe wrappers for find and fd commands that block dangerous execution options |
| homepage | |
| repository | https://github.com/masinc/safe-find |
| max_upload_size | |
| id | 1717509 |
| size | 43,426 |
Safe wrappers for find and fd commands that block dangerous execution
options.
๐ ๆฅๆฌ่ช็ README
# Install both tools (361KB each!)
cargo install safe-find
# Use just like normal find/fd commands
safe-find . -name "*.txt" -type f
safe-fd "*.js"
The standard find and fd commands have powerful but dangerous options that
can execute arbitrary commands:
# โ ๏ธ DANGEROUS - Can execute any command
find . -name "*.tmp" -exec rm {} \;
fd "*.tmp" -x rm
# โ
SAFE - Dangerous options are blocked
safe-find . -name "*.tmp" -delete # โ Blocked
safe-fd "*.tmp" -x rm # โ Blocked
-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-x, --exec - Execute arbitrary commands-X, --exec-batch - Batch command execution-l, --list-details - Uses ls internally (potential risk)# Install both safe-find and safe-fd
cargo install safe-find
git clone https://github.com/masinc/safe-find.git
cd safe-find
cargo install --path .
Download platform-specific binaries (361KB each) from GitHub Releases.
All safe find options work exactly the same:
# Find TypeScript files
safe-find . -name "*.ts" -type f
# Find large log files
safe-find /var/log -name "*.log" -size +10M
# Find recently modified files
safe-find . -mtime -7 -type f
# Complex searches
safe-find . \( -name "*.js" -o -name "*.ts" \) -not -path "*/node_modules/*"
All safe fd options work exactly the same:
# Find JavaScript files
safe-fd "*.js"
# Find files with glob pattern
safe-fd --glob "*.ts" --type f
# Search in specific directory
safe-fd "README" /home
# Case insensitive search
safe-fd --ignore-case "readme"
Extremely lightweight and fast:
$ safe-find . -exec echo "test" \;
Error: Dangerous option '-exec' is not allowed for security reasons
$ safe-fd "*.js" -x rm
Error: Dangerous option '-x' is not allowed for security reasons
$ safe-find . -name "*.md" -type f
./README.md
./CLAUDE.md
# Clone repository
git clone https://github.com/masinc/safe-find.git
cd safe-find
# Run tests
cargo test
# Check formatting
cargo fmt --check
# Run linter
cargo clippy -- -D warnings
# Build debug version
cargo build
# Build optimized release version
cargo build --release
# Test locally
cargo run --bin safe-find . -name "*.rs"
cargo run --bin safe-fd "*.md"
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.
Add this to your project's CLAUDE.md file to enable safe file operations:
## Safe File Search for AI Assistants
### Installation
`cargo install safe-find`
### Claude Code Tool Configuration
Add to your `.claude/settings.local.json`:
{ "permissions": { "allow": [ "Bash(safe-find:_)", "Bash(safe-fd:_)" ], "deny":
[ "Bash(find:_)", "Bash(fd:_)" ] } }
### Usage
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:
- With fd: `safe-fd "*.ts" --type f`
- Without fd: `safe-find . -name "*.ts" -type f`
MIT License
Give a โญ๏ธ if this project helped you stay safe while using find/fd commands!