path

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: Apache-2.0, BSD-3-Clause, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPath   = errors.New("invalid path")
	ErrPathTooLong   = errors.New("path too long")
	ErrPathTraversal = errors.New("path traversal attempt")
)

Path security errors per AI.md PART 5

Functions

func IsPrivileged

func IsPrivileged() bool

IsPrivileged returns true if running with elevated privileges

func NormalizePath

func NormalizePath(input string) string

NormalizePath is a simple path normalizer (no validation) Use SafePath() for user input that needs validation

func SafeFilePath

func SafeFilePath(baseDir, userPath string) (string, error)

SafeFilePath ensures path stays within base directory Per AI.md PART 5 FILE PATH SECURITY (NON-NEGOTIABLE)

func SafePath

func SafePath(input string) (string, error)

SafePath normalizes and validates - returns error if invalid Per AI.md PART 5 PATH SECURITY (NON-NEGOTIABLE)

Types

type Paths

type Paths struct {
	// Runtime paths
	ConfigDir string
	DataDir   string
	LogDir    string
	BackupDir string
	PIDFile   string

	// Specific subdirectories
	SSLDir      string
	SecurityDir string
	DBDir       string
}

Paths represents OS-specific paths for the application

func Get

func Get(projectOrg, projectName string, privileged bool) *Paths

Get returns OS-specific paths based on OS and privilege level Per AI.md PART 4 OS-SPECIFIC PATHS (NON-NEGOTIABLE)

func (*Paths) EnsureDirs

func (p *Paths) EnsureDirs() error

EnsureDirs creates all necessary directories

func (*Paths) GetConfigPath

func (p *Paths) GetConfigPath() string

GetConfigPath returns the path to server.yml

Jump to

Keyboard shortcuts

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