Documentation
¶
Overview ¶
Package sanitizer provides security-focused sanitization functions to prevent common vulnerabilities like command injection, path traversal, and other security issues.
Index ¶
- func Alphanumeric(input string) string
- func CommandArgument(arg string) string
- func ContainerName(name string) string
- func DockerImageName(name string) string
- func FilePath(path string, allowedBaseDir string) (string, error)
- func Filename(filename string) string
- func IsSecurityError(err error) bool
- func Password(password string) string
- func SafeExecArgs(command string, args []string) (string, []string, error)
- func ShellCommand(command string) string
- func URL(url string) string
- type SecurityError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Alphanumeric ¶
Alphanumeric removes all non-alphanumeric characters
func CommandArgument ¶
CommandArgument sanitizes a single command line argument
func ContainerName ¶
ContainerName sanitizes a Docker container name
func DockerImageName ¶
DockerImageName sanitizes a Docker image name for use in command execution
func IsSecurityError ¶
IsSecurityError checks if an error is a SecurityError
func SafeExecArgs ¶
SafeExecArgs prepares arguments for exec.Command with validation
func ShellCommand ¶
ShellCommand sanitizes a shell command for safe execution
Types ¶
type SecurityError ¶
type SecurityError struct {
Message string
}
SecurityError represents a security-related error
func (*SecurityError) Error ¶
func (e *SecurityError) Error() string
Click to show internal directories.
Click to hide internal directories.