Documentation
¶
Overview ¶
Package redact removes credential shapes and personal paths from text that leaves the process: a bug report, a log line, an error string sent to telemetry.
It is pattern-based, so it is a backstop, not a guarantee: it catches the shapes credentials are usually written in (URL userinfo, key=value pairs with a credential-named key, bearer and basic schemes, cookie headers, JWTs, the key prefixes of the common providers, AWS secret access keys, Reliant claim links, long opaque runs) and home directories, which name the person. Text that must never leave the process must not be handed to anything that sends it, redacted or not.
The credential patterns are the ones reliant redacts its agent bug reports with (reliant internal/telemetry), held here so forge, reliant and the control plane share one bar.
Index ¶
Constants ¶
const ( // Marker replaces a redacted credential. Marker = "[redacted]" // TruncatedMarker ends text Bounded cut. TruncatedMarker = " [truncated]" )
Variables ¶
This section is empty.
Functions ¶
func Bounded ¶
Bounded is Text, cut to at most maxBytes UTF-8 bytes, including TruncatedMarker. Invalid UTF-8 is replaced before measuring; cuts never split a rune. A bound smaller than the marker retains only its ASCII prefix. maxBytes <= 0 means no bound. JSON escaping may expand the encoded representation; this bounds the decoded text, not the enclosing JSON.
func HomeDirs ¶
HomeDirs replaces every home directory in s (/home/<user>, /Users/<user>, C:\Users\<user>) with "~", keeping the rest of each path, so text still says which file without saying whose.
Types ¶
This section is empty.