utils

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandPath

func ExpandPath(path string) (string, error)

ExpandPath expands ~ to home directory and resolves relative paths

func SanitizePath

func SanitizePath(projectRoot, targetPath string) (string, error)

SanitizePath creates a safe version of a path by cleaning it and ensuring it stays within bounds. This is used as a secondary safety measure after validation.

func ValidatePath

func ValidatePath(name string) error

ValidatePath ensures a path component is safe for use within a project directory. It prevents path traversal attacks by rejecting paths that: - Are empty or just whitespace - Are absolute paths (including Windows drive paths) - Contain ".." segments - Contain invalid characters for filenames - Contain path separators (should be handled by structure)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL