Skip to main content

validate_within_dir

Function
This function is defined in the workspace module.
Validate that a path is contained within an allowed root directory.

Signature

Parameters

Path
required
Path to validate
Path
required
Root directory that must contain the path

Returns

bool
True if path is within allowed_root, False otherwise

Uses

  • relative_to
  • path.resolve
  • allowed_root.resolve

Source

View on GitHub

praisonaiagents/workspace/__init__.py at line 153