Documentation
¶
Index ¶
Constants ¶
const HeaderValueKeySeparator = "::"
HeaderValueKeySeparator is used when expanding header-valued keys into per-header sub-entries in the redacted output.
const REDACTED = "REDACTED"
REDACTED is the value that replaces sensitive values.
Variables ¶
This section is empty.
Functions ¶
func Redact ¶
func Redact(obj map[string]any, opts ...RedactOption)
Redact walks obj and replaces values of sensitive keys with a redacted placeholder. It mutates obj in place; nested maps and slice elements are modified directly and no copy is returned.
Types ¶
type RedactOption ¶
type RedactOption func(ro *redactOptions)
RedactOption is an optional arg to control how the Redact method works.
func WithErrorOutput ¶
func WithErrorOutput(w io.Writer) RedactOption
WithErrorOutput determines where any error messages that are encountered are written to.
Defaults to io.Discard.
func WithHeaderValueKeys ¶ added in v0.46.0
func WithHeaderValueKeys(keys ...string) RedactOption
WithHeaderValueKeys registers keys whose string values are formatted as comma-separated "Name=Value" pairs (e.g. HTTP header env vars). During redaction each such entry is expanded into "originalKey::Name" sub-entries so that the standard redactKey rules can match the individual header names. Non-sensitive headers are kept with their original value; sensitive ones are replaced with REDACTED.
func WithIgnoreKeys ¶
func WithIgnoreKeys(keys ...string) RedactOption
WithIgnoreKeys sets case-sensitive key values where redaction will be skipped.
func WithMarkerPrefix ¶
func WithMarkerPrefix(s string) RedactOption
WithMarkerPrefix sets the redaction marker prefix string.