safeshell

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package safeshell provides a secure wrapper for subprocess command execution to prevent shell injection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandContext

func CommandContext(ctx context.Context, name string, args ...string) (*exec.Cmd, error)

CommandContext creates a validated, secure exec.Cmd wrapper. It checks the command name for control characters and null bytes, and validates arguments against null bytes.

func Validate

func Validate(val string) error

Validate checks a string argument for safety indicators (e.g. null bytes). Note: In direct execve subprocess execution, operators like |, &, ;, <, >, `, $ and newlines are safe in arguments as they are passed directly without shell interpretation.

func ValidateCommandName added in v0.34.0

func ValidateCommandName(name string) error

ValidateCommandName checks a command executable name for control characters, newlines, and null bytes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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