Documentation
¶
Overview ¶
Package redact provides functions for determining values to redact.
Index ¶
- Constants
- func AppendGoEscaped(needles []string) []string
- func GoEscaped(s string) string
- func MatchAny(patterns []string, name string) (matched bool, err error)
- func NeedlesFromEnv(patterns []string) (values, short []string, err error)
- func New(dst io.Writer, needles []string) *replacer.Replacer
- func Redacted([]byte) []byte
- func String(input string, needles []string) string
- func URLCredentials(rawURL string) string
- func Vars(patterns []string, environment []env.Pair) (matched []env.Pair, short []string, err error)
Constants ¶
const LengthMin = 6
LengthMin is the shortest string length that will be considered a potential secret by the environment redactor. e.g. if the redactor is configured to filter out environment variables matching *_TOKEN, and API_TOKEN is set to "none", this minimum length will prevent the word "none" from being redacted from useful log output.
Variables ¶
This section is empty.
Functions ¶
func AppendGoEscaped ¶ added in v3.133.0
AppendGoEscaped appends the GoEscaped versions of needles, as needed, to catch values printed via %q.
func GoEscaped ¶ added in v3.133.0
GoEscaped is like strconv.Quote, but without the surrounding double quotes.
func NeedlesFromEnv ¶ added in v3.95.0
NeedlesFromEnv matches the patterns against os.Environ. It returns values to redact and the names of env vars with "short" values.
func New ¶ added in v3.95.0
New returns a replacer configured to write to dst, and redact all needles.
func String ¶ added in v3.95.0
String is a convenience wrapper for redacting small strings. This is fine to call repeatedly with many separate strings, but avoid using this to redact large streams - it requires buffering the whole input and output.
func URLCredentials ¶ added in v3.133.1
URLCredentials returns rawURL with any embedded password masked. URLs without one are returned unchanged; an unparsable scheme-based URL returns a placeholder to avoid leaking a credential it may contain.
func Vars ¶
func Vars(patterns []string, environment []env.Pair) (matched []env.Pair, short []string, err error)
Vars returns the variable names and values to be redacted, given a redaction config string and an environment map. It also returned variables whose names match the redacted-vars config, but whose values were too short.
Types ¶
This section is empty.