Open
Conversation
Implement Phase 1.4 tool execution subsystem for secure subprocess execution: **Features:** - Command validation with whitelist (npx, python, node, cargo, etc.) - Shell metacharacter detection to prevent injection attacks - Timeout handling (configurable, default 30s) - Output size limits (1MB default) to prevent memory exhaustion - Path-based command support (Unix and Windows) **Components:** - `tools/validator.rs`: Command validation logic - Whitelist of known-safe commands - Shell metacharacter detection - Custom whitelist support - `tools/executor.rs`: Secure subprocess execution - tokio::process::Command (no shell=True) - Timeout enforcement - Output truncation - Working directory support **Security:** - Defense-in-depth approach with validation + safe subprocess API - No shell=True usage (primary security measure) - Whitelist documents expected command surface - Metacharacter detection catches obvious injection attempts **Testing:** - 29 comprehensive unit tests - Property-based tests with proptest - 99.57% line coverage (executor.rs) - 98.31% line coverage (validator.rs) - Tests: timeout, output truncation, validation, path handling Closes #519 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Phase 1.4 tool execution subsystem for secure subprocess execution of MCP tools.
Changes
New Module:
orchestrator/src/tools/Core Components:
validator.rs: Command validation to prevent shell injection;,&,|,$,`,(,),<,>, newline, tab,*,?,[,])CommandValidator::with_whitelist()executor.rs: Secure subprocess executiontokio::process::Command(noshell=True) - primary security measureSecurity Features:
shell=True(critical security requirement)Updated Files
orchestrator/src/lib.rs: AddedtoolsmoduleTest Coverage
Test Scenarios
Acceptance Criteria
Usage Example
Test Plan
Closes #519
🤖 Generated with Claude Code