Documentation
¶
Overview ¶
Package redact holds the credential-scrubbing primitives: the patterns that recognise a credential in arbitrary text, and the key-name test that recognises one by the name it is stored under.
It lives here, below everything, because there are now TWO consumers with the same requirement and they must not drift: `dash` scrubs before writing a captured request to disk, and `internal/logging` scrubs before writing a log record to stderr or to Loki. A second copy of these patterns would be a second thing to keep current, and the first one forgotten is a leak. `dash` is the historical home (dash/redact.go) and keeps its allowlists — those are about the dashboard's own data shapes; only the credential vocabulary moved.
The reasoning for each mechanism is documented where it is used: see dash/redact.go for why config keys are allowlisted by name, and why content — arbitrary agent output — can only get pattern-based scrubbing plus a size cap.
Index ¶
Constants ¶
const Redacted = "«redacted»"
Redacted is the placeholder written in place of any redacted value. It is deliberately visible: a blank would read as "the field was empty".
Variables ¶
This section is empty.
Functions ¶
func Content ¶
Content scrubs credential-shaped substrings from arbitrary text and caps its length. cap<=0 means no cap. The cap is applied AFTER scrubbing so a secret near the end cannot survive by being truncated into place.
func IsSecretKey ¶
IsSecretKey reports whether a key NAME says "the value under me is a credential". Case-insensitive; callers need not normalise.
func URLCredentials ¶
URLCredentials replaces only the password in a `scheme://user:pass@host` URL, leaving the scheme, the user and the host visible — a wholly redacted URL would make an upstream field useless for the thing it exists to answer ("where is this pointing?").
Types ¶
This section is empty.