redact

package
v0.0.0-...-fbd1cbd Latest Latest
Warning

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

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

Documentation

Overview

Package redact provides product-neutral helpers for removing secret-like values from strings and JSON/YAML-like documents.

Index

Constants

View Source
const (
	// Value is the default marker used in place of redacted content.
	Value = "${redacted}"
)

Variables

This section is empty.

Functions

func Any

func Any(value any, opts ...Options) any

Any redacts secret-like values from common JSON/YAML-like values.

func Document

func Document(value any, opts ...Options) (any, bool)

Document redacts value and reports whether any replacement was made.

func Map

func Map(in map[string]any, opts ...Options) map[string]any

Map redacts a map[string]any document.

func SensitiveKey

func SensitiveKey(key string, opts ...Options) bool

SensitiveKey reports whether a key name usually carries a secret value.

func String

func String(value string, opts ...Options) string

String redacts secret-like values from value.

Types

type Options

type Options struct {
	Marker             string
	ExtraSensitiveKeys []string
	// ExactSensitiveKeys adds case-insensitive whole-key matches. Common key
	// separators are normalized, so raw-capture and raw_capture are equivalent.
	// Use this for domain-specific keys whose names are unsafe only as complete
	// fields; ExtraSensitiveKeys intentionally retains substring matching.
	ExactSensitiveKeys []string
	ExtraPatterns      []*regexp.Regexp
}

Options configures redaction behavior for one call.

Jump to

Keyboard shortcuts

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