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.