validation

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidGitURL = fmt.Errorf("invalid git URL")

ErrInvalidGitURL indicates an invalid or unsafe Git URL.

View Source
var ErrInvalidPath = fmt.Errorf("invalid path")

ErrInvalidPath indicates an invalid path.

View Source
var ErrPathTraversal = fmt.Errorf("path traversal detected")

ErrPathTraversal indicates a path traversal attempt was detected.

Functions

func SanitizePath

func SanitizePath(path string) (string, error)

SanitizePath cleans a path and returns the sanitized version. Returns an error if the path is invalid.

func ValidateDirectory

func ValidateDirectory(dir string) error

ValidateDirectory validates that a directory path is safe. It cleans the path and ensures it doesn't escape the intended boundary.

func ValidateGitURL

func ValidateGitURL(rawURL string) error

ValidateGitURL ensures the URL is safe to use with git clone. It validates the URL format and restricts to safe schemes (https, git, ssh). Local filesystem paths are also allowed for cloning local repositories.

func ValidateLocalPath

func ValidateLocalPath(path string) error

ValidateLocalPath ensures a path doesn't contain traversal attempts. It allows both relative and absolute paths but rejects traversal patterns.

Types

This section is empty.

Jump to

Keyboard shortcuts

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