Module path_validation

Module path_validation 

Source
Expand description

Path validation and security utilities for AGPM.

This module provides utilities for safe path handling, validation, and security checks to prevent path traversal attacks.

Functions§

ensure_directory_exists
Ensures a directory exists, creating it if necessary.
ensure_within_directory
Ensures a path is within a specific directory boundary.
find_project_root
Gets the project root directory from a path.
safe_canonicalize
Safely canonicalizes a path, handling various edge cases.
safe_relative_path
Creates a safe relative path from a base directory.
sanitize_file_name
Sanitizes a file name to remove potentially dangerous characters.
validate_no_traversal
Validates that a path doesn’t contain dangerous components.
validate_project_path
Validates that a path is safe and within project boundaries.
validate_resource_path
Validates and normalizes a file path for a specific resource type.