Documentation
¶
Overview ¶
Package redact masks secrets in text before it leaves the server.
Redaction is a safety net, not a guarantee: providers must still avoid reading secret material in the first place.
Index ¶
Constants ¶
const Mask = "[REDACTED]"
Mask is the replacement for a redacted value.
Variables ¶
This section is empty.
Functions ¶
func Fragment ¶
Fragment renders s[start:end] using ranges computed over the full s. Each visible part of an intersecting secret is masked, even at page boundaries. CR and LF bytes are preserved, masking each nonempty part of a secret line separately so line numbers and line endings remain stable. Bounds must satisfy 0 <= start <= end <= len(s); ranges must come from Ranges(s).
func SensitiveFlag ¶
SensitiveFlag reports whether a standalone long flag takes a secret value. Short flags are deliberately excluded because their meanings vary by program.
func SensitiveKey ¶
SensitiveKey reports whether a key's value is masked by Value.
Types ¶
type Range ¶
Range is a sensitive byte interval [Start, End) in the original text.
func Ranges ¶
Ranges returns sorted, non-overlapping sensitive ranges in s. Incomplete private-key PEM blocks extend to the source boundary. A quoted assignment left open on its line extends to its closing quote when that quote follows within maxQuotedBytes and maxQuotedLines; otherwise it extends to the end of its first line.