pathutil

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package pathutil provides shared path security utilities.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPathTraversal   = errors.New("path traversal detected")
	ErrPathOutsideBase = errors.New("path outside allowed base directory")
)

Security-related errors.

Functions

func ContainsTraversal

func ContainsTraversal(path string) bool

ContainsTraversal checks if a path contains obvious traversal patterns.

func SanitizeError

func SanitizeError(operation string, err error) error

SanitizeError returns a user-safe error message that doesn't expose sensitive path information. The original error is preserved for logging. Use this when returning errors that might contain full file paths.

Types

This section is empty.

Jump to

Keyboard shortcuts

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