redact

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package redact is the shared belt-and-suspenders scrubber for secret material on its way to any sink – logs, the audit writer, the evidence seal, tool output. It is defense-in-depth behind the vault: the vault keeps secrets out of argv and the worker env, and redact ensures that if a tool echoes its own token (or a URL carries embedded creds) the value is removed before it is published or sealed.

Index

Constants

View Source
const Placeholder = "[REDACTED]"

Placeholder is what a redacted secret is replaced with.

Variables

This section is empty.

Functions

func Bytes

func Bytes(data []byte, secrets [][]byte) []byte

Bytes removes every non-empty secret value from data (exact substring match) and strips URL-embedded creds. Used to scrub a tool's stdout/stderr before it is logged or sealed, so a tool that prints its own injected token is caught.

Each secret is scrubbed both verbatim AND in its common ENCODED forms – base64 (std + URL-safe, padded + unpadded) and lower/upper hex – because a tool that echoes base64(token) or hex(token) would otherwise defeat a verbatim-only scrub (demonstrated in the red-team audit). DEFENSE-IN-DEPTH ONLY, not the primary control: the vault keeps plaintext out of argv/`/proc` and injects via the child env, so a secret reaches here only if a misbehaving tool echoes it. An ARBITRARY transform (gzip, XOR, char-by-char) can still defeat any substring scrub – treat a tool that can emit attacker-chosen output AND holds a secret as able to exfiltrate it; the vault scoping is what bounds blast radius.

func String

func String(s string, secrets []string) string

String is the string form of Bytes for log/error messages.

func URLCreds

func URLCreds(s string) string

URLCreds strips credentials embedded in any URL, keeping the scheme + host: https://user:pass@h → https://***@h. (Generalizes acquire.credsRE / sca.credInErr.)

Types

This section is empty.

Jump to

Keyboard shortcuts

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