validate_shell_input
Validates shell input to block command injection by detecting dangerous metacharacters, environment variable tricks, and encoding bypasses before execution.
Instructions
Prevent command injection (RCE). Validates shell input for dangerous metacharacters (&, |, ;, $(), backticks), environment variable tricks, and encoding bypasses. Run this before executing any shell command generated by an LLM or received from user input.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"input": "<input>"
},
"name": "validate_shell_input"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Validation mode: 'strict' blocks threats, 'advisory' provides warnings (default: strict) | |
| input | Yes | The shell command or string to validate | |
| sensitivity | No | Detection sensitivity: high=aggressive, medium=balanced, low=high-confidence only (default: medium) | |
| allowedCommands | No | List of allowed commands to exclude from threat detection (e.g., ['ls', 'cat', 'echo']) |