redact

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const RedactedPlaceholder = "REDACTED"

RedactedPlaceholder is the replacement text used for redacted secrets.

Variables

This section is empty.

Functions

func Bytes

func Bytes(b []byte) []byte

Bytes is a convenience wrapper around String for []byte content.

func JSONLBytes

func JSONLBytes(b []byte) ([]byte, error)

JSONLBytes is a convenience wrapper around JSONLContent for []byte content.

func JSONLContent

func JSONLContent(content string) (string, error)

JSONLContent parses each line as JSON to determine which string values need redaction, then performs targeted replacements on the raw JSON bytes. Lines with no secrets are returned unchanged, preserving original formatting.

func String

func String(s string) string

String replaces secrets in s with "REDACTED" using layered detection: 1. Entropy-based: high-entropy alphanumeric sequences (threshold 4.5) 2. Pattern-based: gitleaks regex rules (180+ known secret formats) A string is redacted if EITHER method flags it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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