Documentation
¶
Overview ¶
Package validate provides security validation functions for sensitive data
Package validate provides functions to validate various aspects of the application.
Index ¶
Constants ¶
const ( MaxSecretFileSize = 1024 * 1024 // 1MB - Maximum size for secret files MaxEnvValueSize = 32768 // 32KB - Maximum size for environment variable values MaxSecretNameLen = 253 // DNS name limit - Maximum length for secret names MaxEnvKeyLen = 256 // Maximum length for environment variable keys MaxSecretTargetLen = 4096 // Maximum length for secret target paths )
Security constants for size limits and validation.
Variables ¶
This section is empty.
Functions ¶
func SanitizeForLogging ¶ added in v0.16.1
SanitizeForLogging redacts sensitive information from strings for safe logging.
func SetCommandRunner ¶
func SetCommandRunner(runner CommandRunner)
SetCommandRunner allows tests to inject a mock runner.
func SystemRequirements ¶
func SystemRequirements() error
SystemRequirements checks if all required system tools are installed.
Types ¶
type CommandRunner ¶
CommandRunner defines an interface for executing commands.
type RealCommandRunner ¶
type RealCommandRunner struct{}
RealCommandRunner implements CommandRunner using os/exec.
func (*RealCommandRunner) Run ¶
func (r *RealCommandRunner) Run(name string, args ...string) ([]byte, error)
Run executes a command and returns its output. WARNING: This method executes arbitrary commands and should only be used with trusted input. Callers must validate command names and arguments to prevent command injection.
type SecretValidator ¶ added in v0.16.1
type SecretValidator struct {
// contains filtered or unexported fields
}
SecretValidator provides validation for secrets and sensitive data.
func NewSecretValidator ¶ added in v0.16.1
func NewSecretValidator() *SecretValidator
NewSecretValidator creates a new SecretValidator instance.
func (*SecretValidator) ValidateEnvValue ¶ added in v0.16.1
func (sv *SecretValidator) ValidateEnvValue(key, value string) error
ValidateEnvValue validates environment variable values for size and content.
func (*SecretValidator) ValidateSecretName ¶ added in v0.16.1
func (sv *SecretValidator) ValidateSecretName(name string) error
ValidateSecretName validates that a secret name is safe and follows conventions.
func (*SecretValidator) ValidateSecretTarget ¶ added in v0.16.1
func (sv *SecretValidator) ValidateSecretTarget(target string) error
ValidateSecretTarget validates that a secret target path is safe.
func (*SecretValidator) ValidateSecretValue ¶ added in v0.16.1
func (sv *SecretValidator) ValidateSecretValue(value string) error
ValidateSecretValue validates that a secret value is safe and within size limits.