validate_file_path
Validates user-provided file paths to prevent path traversal and local file inclusion by detecting ../ sequences, encoding tricks, and null bytes while ensuring containment within the project root.
Instructions
Prevent path traversal (LFI). Detects ../ sequences, URL/double encoding, null bytes, and ensures paths stay within projectRoot. Use when processing user-provided file paths to prevent unauthorized file access.
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": {
"filePath": "<filePath>"
},
"name": "validate_file_path"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Validation mode (default: strict) | |
| filePath | Yes | The file path to validate | |
| projectRoot | No | Project root directory to check containment against | |
| sensitivity | No | Detection sensitivity (default: high) |