redact

package
v0.7.19 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package redact scrubs known secret values from strings before logging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Target added in v0.7.16

func Target(kind, raw string) string

Target returns a sanitized, human-readable identifier for a publish destination, suitable for storage and display. Webhook URLs collapse to their host. github-issue URLs collapse to "<owner>/<repo>". Channel-style or email targets pass through. Inputs that can't be classified pass through unchanged.

Types

type Redactor

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

Redactor replaces known secret values with a fixed placeholder.

Callers must funnel any string through Redact before it reaches a log sink; the redactor cannot intercept logs it never sees. Typical wiring is to construct one Redactor per run from secrets.Resolver.AllValues() and use it as the single log-formatting choke point.

func New

func New(secrets []string) *Redactor

New returns a Redactor that scrubs the given secret values. Empty strings are ignored. Values are sorted longest-first so that overlapping secrets redact to their most specific match.

func (*Redactor) Redact

func (r *Redactor) Redact(s string) string

Redact returns s with every known secret value replaced by "[REDACTED]".

Jump to

Keyboard shortcuts

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