redact

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package redact shares structured secret handling without cryptographic dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Redact

func Redact(v any) any

Redact returns a recursively redacted copy of JSON-like data. Free text must not contain secrets.

func SafeText

func SafeText(s string) string

SafeText masks common credential assignments, private-key PEM blocks and credential-bearing URLs. Application-specific unlabeled secrets still require an explicit application sanitizer and must not be logged.

func SafeURL

func SafeURL(u url.URL) string

SafeURL removes passwords and sensitive query values. It returns a copy and never changes the caller's URL.

func SafeValue

func SafeValue(v any) any

SafeValue handles typed JSON-like values, secret tags and cycles with a bounded traversal budget. It deliberately avoids invoking arbitrary MarshalJSON/String methods on structs.

func Sensitive

func Sensitive(key string) bool

Sensitive identifies structured fields that must never be logged.

Types

This section is empty.

Jump to

Keyboard shortcuts

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