config

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandValidator

type CommandValidator struct {
	// contains filtered or unexported fields
}

CommandValidator provides security validation for command arguments

func NewCommandValidator

func NewCommandValidator() *CommandValidator

NewCommandValidator creates a new command validator with security rules

func (*CommandValidator) SanitizeCommand

func (v *CommandValidator) SanitizeCommand(cmd string) string

SanitizeCommand removes potentially dangerous characters from a command string

func (*CommandValidator) ValidateCommandArgs

func (v *CommandValidator) ValidateCommandArgs(args []string) error

ValidateCommandArgs validates command arguments for safety

func (*CommandValidator) ValidateFilePath

func (v *CommandValidator) ValidateFilePath(path string) error

ValidateFilePath validates a Docker compose file path for safety

func (*CommandValidator) ValidateServiceName

func (v *CommandValidator) ValidateServiceName(service string) error

ValidateServiceName validates a Docker service name for safety

type Sanitizer

type Sanitizer struct {
	// contains filtered or unexported fields
}

Sanitizer provides input sanitization and validation for security

func NewSanitizer

func NewSanitizer() *Sanitizer

NewSanitizer creates a new input sanitizer

func (*Sanitizer) SanitizeHTML

func (s *Sanitizer) SanitizeHTML(input string) string

SanitizeHTML performs HTML escaping to prevent XSS

func (*Sanitizer) SanitizeString

func (s *Sanitizer) SanitizeString(input string, maxLength int) (string, error)

SanitizeString performs basic string sanitization

func (*Sanitizer) ValidateCommand

func (s *Sanitizer) ValidateCommand(command string) error

ValidateCommand validates command strings for shell execution

func (*Sanitizer) ValidateCronExpression

func (s *Sanitizer) ValidateCronExpression(expr string) error

ValidateCronExpression performs thorough cron expression validation

func (*Sanitizer) ValidateDockerImage

func (s *Sanitizer) ValidateDockerImage(image string) error

ValidateDockerImage validates Docker image names

func (*Sanitizer) ValidateEmailList

func (s *Sanitizer) ValidateEmailList(emails string) error

ValidateEmailList validates a comma-separated list of email addresses

func (*Sanitizer) ValidateEnvironmentVar

func (s *Sanitizer) ValidateEnvironmentVar(name, value string) error

ValidateEnvironmentVar validates environment variable names and values

func (*Sanitizer) ValidateJobName

func (s *Sanitizer) ValidateJobName(name string) error

ValidateJobName validates job names for safety

func (*Sanitizer) ValidatePath

func (s *Sanitizer) ValidatePath(path string, allowedBasePath string) error

ValidatePath validates file paths to prevent traversal attacks

func (*Sanitizer) ValidateURL

func (s *Sanitizer) ValidateURL(rawURL string) error

ValidateURL validates URLs to prevent SSRF and other attacks

type ValidationError

type ValidationError struct {
	Field   string
	Value   interface{}
	Message string
}

ValidationError represents a configuration validation error

func (ValidationError) Error

func (e ValidationError) Error() string

type ValidationErrors

type ValidationErrors []ValidationError

ValidationErrors represents multiple validation errors

func (ValidationErrors) Error

func (e ValidationErrors) Error() string

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

Validator provides configuration validation

func NewValidator

func NewValidator() *Validator

NewValidator creates a new configuration validator

func (*Validator) AddError

func (v *Validator) AddError(field string, value interface{}, message string)

AddError adds a validation error

func (*Validator) Errors

func (v *Validator) Errors() ValidationErrors

Errors returns all validation errors

func (*Validator) HasErrors

func (v *Validator) HasErrors() bool

HasErrors returns true if there are validation errors

func (*Validator) ValidateCronExpression

func (v *Validator) ValidateCronExpression(field string, value string)

ValidateCronExpression validates a cron expression

func (*Validator) ValidateEmail

func (v *Validator) ValidateEmail(field string, value string)

ValidateEmail validates that a string is a valid email

func (*Validator) ValidateEnum

func (v *Validator) ValidateEnum(field string, value string, allowed []string)

ValidateEnum validates that a value is in a list of allowed values

func (*Validator) ValidateMaxLength

func (v *Validator) ValidateMaxLength(field string, value string, maxLength int)

ValidateMaxLength validates maximum string length

func (*Validator) ValidateMinLength

func (v *Validator) ValidateMinLength(field string, value string, minLength int)

ValidateMinLength validates minimum string length

func (*Validator) ValidatePath

func (v *Validator) ValidatePath(field string, value string)

ValidatePath validates that a path exists or can be created

func (*Validator) ValidatePositive

func (v *Validator) ValidatePositive(field string, value int)

ValidatePositive validates that a number is positive

func (*Validator) ValidateRange

func (v *Validator) ValidateRange(field string, value int, minVal, maxVal int)

ValidateRange validates that a number is within range

func (*Validator) ValidateRequired

func (v *Validator) ValidateRequired(field string, value string)

ValidateRequired validates that a field is not empty

func (*Validator) ValidateURL

func (v *Validator) ValidateURL(field string, value string)

ValidateURL validates that a string is a valid URL

type Validator2

type Validator2 struct {
	// contains filtered or unexported fields
}

ConfigValidator validates complete configuration

func NewConfigValidator

func NewConfigValidator(config interface{}) *Validator2

NewConfigValidator creates a configuration validator

func (*Validator2) Validate

func (cv *Validator2) Validate() error

Validate performs validation on the configuration

Jump to

Keyboard shortcuts

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