validate

package
v0.21.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package validate provides security validation functions for sensitive data

Package validate provides functions to validate various aspects of the application.

Index

Constants

View Source
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 EnvKey added in v0.16.1

func EnvKey(key string) error

EnvKey provides extended validation for environment variable keys. Deprecated: Use SecretValidator.ValidateEnvKey instead.

func SanitizeForLogging added in v0.16.1

func SanitizeForLogging(key, value string) string

SanitizeForLogging redacts sensitive information from strings for safe logging.

func SystemRequirements

func SystemRequirements() error

SystemRequirements checks if all required system tools are installed. Deprecated: Use NewValidator and Validator.SystemRequirements instead.

Types

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(logger log.Logger) *SecretValidator

NewSecretValidator creates a new SecretValidator instance.

func (*SecretValidator) ValidateEnvKey added in v0.21.0

func (sv *SecretValidator) ValidateEnvKey(key string) error

ValidateEnvKey provides extended validation for environment variable keys.

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.

type Validator added in v0.21.0

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

Validator provides system requirements validation with dependency injection.

func NewValidator added in v0.21.0

func NewValidator(logger log.Logger, runner execx.Runner) *Validator

NewValidator creates a new Validator with the provided logger and command runner.

func NewValidatorWithDefaults added in v0.21.0

func NewValidatorWithDefaults(logger log.Logger) *Validator

NewValidatorWithDefaults creates a new Validator with default dependencies.

func (*Validator) SystemRequirements added in v0.21.0

func (v *Validator) SystemRequirements() error

SystemRequirements checks if all required system tools are installed.

Jump to

Keyboard shortcuts

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