Help us shape the future of Go! Take the 2026 Go Developer Survey

redact

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const TruncMarker = "\n[... truncated by xis: %d of %d bytes kept ...]"

Variables

View Source
var FakeSecrets = map[string]string{
	"aws":       "AKIAZ7Q3XW4YRT2LKP6M",
	"github":    "ghp_9fK2mQx7Lp4Rt8Vz1Wb6Nc3Hd5Js0Ya2EuTi",
	"anthropic": "sk-ant-api03-Xq7vL2pR9tK4mW8zN1bC6dF3hJ5gS0aE7uY2iO4lP9kQ3rT6wV1xZ8nM5bH2cG4fD7sA0eJ3kL6mN9pQ2rS5tU8vW1xY4zAA",
	"openai":    "sk-proj-Rt7Yq2Lm9Xp4Kv8Wz3Nb6Hc1Jd5Fs0Ga7Ue2Ti4Oy9Pl3Mk6Nj8Bh1Vg5Cf2Dx7Sw0Ea3Qr6Zt9Lu4Iy7Om2Pn5Kb8Jv1Hc3",
	"pem":       "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEA3Tz2mr7SZiAMfQyuvBjM9Oi8TjVxQsq3Lr2Kp9Wx4Yz7Nb6Hc1Jd5\nFs0Ga7Ue2Ti4Oy9Pl3Mk6Nj8Bh1Vg5Cf2Dx7Sw0Ea3Qr6Zt9Lu4Iy7Om2Pn5Kb8Jv1Hc3Rt7Y\nq2Lm9Xp4Kv8Wz3Nb6Hc1Jd5Fs0Ga7Ue2Ti4Oy9Pl3Mk6Nj8Bh1Vg5Cf2Dx7Sw0Ea3Qr6Zt9\n-----END RSA PRIVATE KEY-----",
}

FakeSecrets are invented credentials in real formats, for tests in all packages.

Functions

func Token

func Token(rule, secret string) string

func Truncate

func Truncate(s string, max int) string

Types

type Finding

type Finding struct {
	Rule   string
	Secret string
}

type Redactor

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

func New

func New(cfg config.Redact) (*Redactor, error)

func (*Redactor) Findings

func (r *Redactor) Findings(s string) []Finding

func (*Redactor) JSON

func (r *Redactor) JSON(raw []byte) []byte

func (*Redactor) String

func (r *Redactor) String(s string) string

Jump to

Keyboard shortcuts

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