sanitizer

package
v0.2.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRedactedFieldNames

func GetRedactedFieldNames() []string

GetRedactedFieldNames returns common field names that often contain secrets

func IsLikelySecret

func IsLikelySecret(input string) bool

IsLikelySecret performs a heuristic check if a string looks like a secret

func SanitizeString

func SanitizeString(input string) string

SanitizeString is a convenience function for sanitizing a single string

func ShouldRedactField

func ShouldRedactField(fieldName string) bool

ShouldRedactField checks if a field name suggests it contains sensitive data

Types

type Pattern

type Pattern struct {
	Name        string
	Regex       *regexp.Regexp
	Replacement string
}

Pattern represents a secret detection pattern

type Sanitizer

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

Sanitizer removes sensitive information from data structures

func NewSanitizer

func NewSanitizer() *Sanitizer

NewSanitizer creates a new sanitizer with default patterns

func (*Sanitizer) AddPattern

func (s *Sanitizer) AddPattern(name, pattern, replacement string) error

AddPattern adds a custom pattern to the sanitizer

func (*Sanitizer) Sanitize

func (s *Sanitizer) Sanitize(data interface{}) interface{}

Sanitize recursively sanitizes data structures, replacing detected secrets

Jump to

Keyboard shortcuts

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