redact

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package redact masks secrets in text before it is written to disk.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Redactor

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

Redactor masks known secret formats plus specific secret values.

func FromEnv

func FromEnv(namePatterns []string, extra ...string) *Redactor

FromEnv returns a redactor for the values of environment variables whose names match any of the glob patterns (case-insensitive), e.g. "*_API_KEY".

func New

func New(values ...string) *Redactor

New returns a redactor that also masks the given literal values (ignoring ones shorter than 8 characters, which would cause false positives).

func (*Redactor) String

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

String masks secrets in s. A nil Redactor still applies the built-in patterns.

func (*Redactor) Value

func (r *Redactor) Value(v any) any

Value masks secrets inside strings nested in maps and slices (e.g. tool arguments), returning a copy.

Jump to

Keyboard shortcuts

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