Documentation
¶
Overview ¶
Package redact handles regex-based field redaction for Keep's redact action.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CompiledPattern ¶
CompiledPattern is a pre-compiled redact pattern.
func CompilePatterns ¶
func CompilePatterns(patterns []config.RedactPattern) ([]CompiledPattern, error)
CompilePatterns compiles a list of config redact patterns into CompiledPatterns.
type Mutation ¶
type Mutation struct {
Path string
// Original holds the pre-redaction value. It is populated for audit
// purposes but MUST NOT be returned to the calling agent or exposed
// externally. Callers should strip this field before serializing
// the result outside the engine.
Original string `json:"-"`
Replaced string
}
Mutation describes a single field change.
func Apply ¶
func Apply(params map[string]any, target string, patterns []CompiledPattern) []Mutation
Apply runs compiled patterns against the string value at the given field path in params. Returns the list of mutations (empty if no patterns matched). Does not modify params.
The target path uses the form "params.field" or "params.nested.field". The "params." prefix is stripped before navigating the map.
Click to show internal directories.
Click to hide internal directories.