scrub

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package scrub removes secret values from anything leaving devbay.

The rule it enforces is that a secret never enters model context: not in a manifest, not in a prompt, not in logs returned to an agent. Everything upstream tries to make that true by construction -- secrets are references until spawn time, and the manifest rejects literals -- but an application will happily print its own configuration, and an error message from a third-party SDK will happily quote the credential it just used.

So this is the last line rather than the only one. It works from the exact values the broker resolved, which is the one thing a pattern matcher cannot know, and falls back to shape-based detection for credentials that were never handed out by devbay at all.

Index

Constants

View Source
const Redaction = "[redacted]"

Redaction is what replaces a secret. It names the reference rather than the value where one is known, so a developer reading a scrubbed log can still tell which credential was involved.

Variables

This section is empty.

Functions

func Text

func Text(in string) string

Text scrubs a string with shape detection only, for callers with no scrubber to hand.

Types

type Scrubber

type Scrubber struct {
	// contains filtered or unexported fields
}

Scrubber removes known secret values and credential-shaped strings.

The zero value is usable and does shape-based scrubbing only.

func New

func New() *Scrubber

New returns an empty scrubber.

func (*Scrubber) Add

func (s *Scrubber) Add(ref, value string)

Add registers a secret value and the reference it came from.

Short values are ignored: a one- or two-character "secret" would match everywhere and redact the whole log into uselessness, which is its own kind of failure.

func (*Scrubber) Bytes

func (s *Scrubber) Bytes(in []byte) []byte

Bytes scrubs a byte slice.

func (*Scrubber) Len

func (s *Scrubber) Len() int

Len reports how many values are registered.

func (*Scrubber) Lines

func (s *Scrubber) Lines(in []string) []string

Lines scrubs each line of a log.

func (*Scrubber) String

func (s *Scrubber) String(in string) string

String scrubs a single string.

Jump to

Keyboard shortcuts

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