Documentation
¶
Index ¶
- type CommandValidator
- type Sanitizer
- func (s *Sanitizer) SanitizeHTML(input string) string
- func (s *Sanitizer) SanitizeString(input string, maxLength int) (string, error)
- func (s *Sanitizer) ValidateCommand(command string) error
- func (s *Sanitizer) ValidateCronExpression(expr string) error
- func (s *Sanitizer) ValidateDockerImage(image string) error
- func (s *Sanitizer) ValidateEmailList(emails string) error
- func (s *Sanitizer) ValidateEnvironmentVar(name, value string) error
- func (s *Sanitizer) ValidateJobName(name string) error
- func (s *Sanitizer) ValidatePath(path string, allowedBasePath string) error
- func (s *Sanitizer) ValidateURL(rawURL string) error
- type ValidationError
- type ValidationErrors
- type Validator
- func (v *Validator) AddError(field string, value interface{}, message string)
- func (v *Validator) Errors() ValidationErrors
- func (v *Validator) HasErrors() bool
- func (v *Validator) ValidateCronExpression(field string, value string)
- func (v *Validator) ValidateEmail(field string, value string)
- func (v *Validator) ValidateEnum(field string, value string, allowed []string)
- func (v *Validator) ValidateMaxLength(field string, value string, maxLength int)
- func (v *Validator) ValidateMinLength(field string, value string, minLength int)
- func (v *Validator) ValidatePath(field string, value string)
- func (v *Validator) ValidatePositive(field string, value int)
- func (v *Validator) ValidateRange(field string, value int, minVal, maxVal int)
- func (v *Validator) ValidateRequired(field string, value string)
- func (v *Validator) ValidateURL(field string, value string)
- type Validator2
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 (*Sanitizer) SanitizeHTML ¶
SanitizeHTML performs HTML escaping to prevent XSS
func (*Sanitizer) SanitizeString ¶
SanitizeString performs basic string sanitization
func (*Sanitizer) ValidateCommand ¶
ValidateCommand validates command strings for shell execution
func (*Sanitizer) ValidateCronExpression ¶
ValidateCronExpression performs thorough cron expression validation
func (*Sanitizer) ValidateDockerImage ¶
ValidateDockerImage validates Docker image names
func (*Sanitizer) ValidateEmailList ¶
ValidateEmailList validates a comma-separated list of email addresses
func (*Sanitizer) ValidateEnvironmentVar ¶
ValidateEnvironmentVar validates environment variable names and values
func (*Sanitizer) ValidateJobName ¶
ValidateJobName validates job names for safety
func (*Sanitizer) ValidatePath ¶
ValidatePath validates file paths to prevent traversal attacks
func (*Sanitizer) ValidateURL ¶
ValidateURL validates URLs to prevent SSRF and other attacks
type ValidationError ¶
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) Errors ¶
func (v *Validator) Errors() ValidationErrors
Errors returns all validation errors
func (*Validator) ValidateCronExpression ¶
ValidateCronExpression validates a cron expression
func (*Validator) ValidateEmail ¶
ValidateEmail validates that a string is a valid email
func (*Validator) ValidateEnum ¶
ValidateEnum validates that a value is in a list of allowed values
func (*Validator) ValidateMaxLength ¶
ValidateMaxLength validates maximum string length
func (*Validator) ValidateMinLength ¶
ValidateMinLength validates minimum string length
func (*Validator) ValidatePath ¶
ValidatePath validates that a path exists or can be created
func (*Validator) ValidatePositive ¶
ValidatePositive validates that a number is positive
func (*Validator) ValidateRange ¶
ValidateRange validates that a number is within range
func (*Validator) ValidateRequired ¶
ValidateRequired validates that a field is not empty
func (*Validator) ValidateURL ¶
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