Skip to main content

Module path_utils

Module path_utils 

Source
Expand description

Shared path resolution utilities for tool implementations.

Path resolution functions (expand_home, strip_curdir, normalize_path, resolve_file_path, resolve_dir_path) are defined in opendev-tools-core::path and re-exported here for backward compatibility. This module additionally provides security-boundary functions (validate_path_access, is_sensitive_file) that are tool-level concerns.

Functionsยง

expand_home
Expand tilde (~) and $HOME prefixes in a path string.
is_sensitive_file
Check if a file is likely to contain sensitive data (secrets, credentials, keys).
normalize_path
Normalize a path by collapsing . and .. components without touching the filesystem.
resolve_dir_path
Resolve a user-provided directory path against the working directory.
resolve_file_path
Resolve a user-provided file path against the working directory.
strip_curdir
Strip leading . and ./ components from a path, returning the meaningful portion. E.g., ./myproject/src -> myproject/src.
validate_path_access
Validate that a resolved path is safe to access.