redact

package
v0.7.1 Latest Latest
Warning

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

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

Documentation

Overview

Package redact masks secrets out of captured evidence before it is stored, materialized into content-addressed objects, or exported into a signed forensics bundle.

The threat it addresses is concrete: the sensor captures raw agent activity verbatim — an execve's full argv (including a `curl -H "x-api-key: sk-..."`), and, once full-TLS-body capture lands, the plaintext of the agent's own LLM requests. Any of those can carry a live API key. Evidence flows to many sinks (the store, the dashboard, `--json` output, and a SIGNED, shareable bundle), so masking has to happen at capture/write time, not only when one sink renders — a single un-redacted export is a public leak.

Matching strategy: anchored provider-token patterns are PRIMARY. They key on the token's own high-entropy prefix (`sk-`, `ghp_`, `AKIA`, ...) so they fire regardless of serialization — the same key is caught whether it sits in a joined command string (`... x-api-key: sk-123 ...`) or an argv array where the header name and value are split across separate JSON tokens (`["x-api-key:","sk-123"]`). A key/value pattern is SECONDARY, for secrets that lack a recognizable prefix but appear next to a telltale field name.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Redact

func Redact(s string) (string, bool)

Redact masks secrets in s and reports whether anything was replaced. It is safe to run over a JSON payload string: the token patterns match only the secret substrings, not JSON structural characters, so the surrounding document stays well-formed.

func RedactHeaders

func RedactHeaders(headers map[string]string) bool

RedactHeaders masks the values of credential-bearing headers in place and reports whether anything was masked. Used by tlsintent on a reassembled HTTP message's header map, where masking by name is precise.

func RedactString

func RedactString(s string) string

RedactString is Redact without the changed flag, for call sites that just want the safe string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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