Skip to main content

validate_tool_path

Function validate_tool_path 

Source
pub fn validate_tool_path(path: &str) -> Result<(), SynwireError>
Expand description

Validate a path for safety (no traversal, no null bytes, no absolute paths).

This is a defence-in-depth measure to prevent tools from accessing files outside their intended sandbox.

ยงErrors

Returns SynwireError::Tool with ToolError::PathTraversal if the path:

  • Contains null bytes
  • Contains .. path traversal components
  • Starts with / or \ (absolute path)
  • Contains Windows-style drive letters (e.g. C:)