filesystem

package
v0.89.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PermDir      = 0o755 // Directory permission
	PermOwner    = 0o600 // Owner permission
	PermGroup    = 0o640 // Group permission
	PermPublic   = 0o644 // Public permission
	PermReadOnly = 0o444 // Read-only permission
)

Variables

View Source
var (
	ErrInvalidFilePath = errors.New("invalid file path")
	ErrPathTraversal   = errors.New("path traversal detected")
)
View Source
var IgnoreDirs = set.New(
	".git",
	".github",
	".vscode",
	".idea",
	"node_modules",
)

IgnoreDirs contains directory names that should be skipped during repository walks for internal maintenance tasks (for example decrypt scans and auto-discovery scans).

Functions

func InBasePath added in v0.76.0

func InBasePath(basePath, path string) bool

InBasePath checks if the given path is within the base path, preventing path traversal attacks.

func IsDir added in v0.74.0

func IsDir(path string) bool

IsDir checks if the given path is a directory.

func IsFile added in v0.74.0

func IsFile(path string) bool

IsFile checks if the given path is a regular file without any mode bits set (like symlink, socket, named pipe, etc.).

func IsIgnoredDir added in v0.89.0

func IsIgnoredDir(name string) bool

IsIgnoredDir returns true when the directory name is in IgnoreDirs.

func IsSocket added in v0.74.0

func IsSocket(path string) bool

IsSocket checks if the given path is a socket file.

func IsSymlink(path string) bool

IsSymlink checks if the given path is a symbolic link.

func VerifyAndSanitizePath

func VerifyAndSanitizePath(path, trustedRoot string) (string, error)

VerifyAndSanitizePath checks if a file path is valid and sanitizes it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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