pub fn validate_file_path(path: &str) -> Result<String, String>Expand description
Validate file path to prevent directory traversal attacks
§Checks
- Rejects paths with
..(directory traversal attempts) - Rejects absolute paths outside the project
- Rejects paths with null bytes
- Rejects paths targeting sensitive files (.ssh, .aws, .env, etc.)
§Arguments
path- The file path to validate
§Returns
Ok(path)- The validated path if all checks passErr(reason)- A string describing why the path was rejected