pathutil

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package pathutil provides utilities for safe path handling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustSanitizeName

func MustSanitizeName(name string)

MustSanitizeName is like SanitizeName but panics on error. Use only in contexts where the name has already been validated.

func SanitizeName

func SanitizeName(name string) error

SanitizeName validates and sanitizes a resource name (server, command, skill, rule) to prevent path traversal attacks when used in filepath.Join().

The function: - Rejects empty names - Rejects names containing path separators (/, \) - Rejects names containing ".." sequences - Rejects names that don't match the safe character pattern

Returns an error if the name is invalid.

Types

This section is empty.

Jump to

Keyboard shortcuts

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