Documentation
¶
Overview ¶
Package secret holds the one list of secret strings (repository passwords, notification URLs, API tokens) that must never reach a log line, an error message, or an API response (secrets must never leak).
A Set is shared by pointer between every component that redacts — the command runner, the pipeline, the scheduler, and the API — so a secret that first appears while the program is already running (a repository password generated for a new destination, a notification URL added after startup) is redacted everywhere the moment it is added, without restarting.
Index ¶
Constants ¶
const Placeholder = "[redacted]"
Placeholder replaces every redacted secret.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set is a concurrency-safe, growable list of secrets. A nil *Set is valid and redacts nothing.
func (*Set) AddFile ¶
AddFile records the contents of the secret file at path (surrounding whitespace trimmed, as many tools trim a password file). A missing or unreadable file adds nothing and is not an error: the command that actually uses the file reports that problem loudly; this only makes sure whatever that command can read is redacted. Calling it again after the file changed adds the new value too.
func (*Set) Redact ¶
Redact replaces every occurrence of every secret in text with Placeholder, in a single pass: replaced text is never scanned again, and where secrets overlap the longest wins, so a secret that is a prefix of another cannot leave the longer one's tail visible (e.g. "https://ntfy.sh/abc" and "https://ntfy.sh/abc-photos").