Documentation
¶
Overview ¶
Package fileutils provides file operation utilities including atomic writes.
Package fileutils provides file operation utilities including atomic writes and path validation for security.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtomicWriteFile ¶
AtomicWriteFile writes data to a file atomically by writing to a temporary file and then renaming it. This ensures that readers either see the complete old file or the complete new file, never a partially written file.
func ValidateWorkloadNameForPath ¶
ValidateWorkloadNameForPath validates a workload name to prevent path traversal attacks. It ensures the name is safe for use in file path construction by checking: - Path traversal patterns (..) - Absolute paths - Path separators (/, \) - Command injection patterns - Null bytes - Invalid characters (only alphanumeric, dots, hyphens, underscores allowed) - Length limits
This function delegates to types.ValidateWorkloadName which performs comprehensive validation including filepath.Clean normalization and filepath.Rel path traversal checks.
Returns nil if the workload name is safe for path construction, or an error describing the validation failure.
Types ¶
This section is empty.