redact

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine handles sensitive data detection and replacement

func NewEngine

func NewEngine(s *session.Manager, prefix string) *Engine

NewEngine creates a new redaction engine

func (*Engine) AddBuiltin

func (e *Engine) AddBuiltin(name string) error

AddBuiltin adds a built-in rule to the engine (typically driven by config patterns.builtin).

func (*Engine) AddExclude

func (e *Engine) AddExclude(pattern string)

AddExclude adds an exclude pattern

func (*Engine) AddKeyword

func (e *Engine) AddKeyword(keyword, category string)

AddKeyword adds a keyword pattern

func (*Engine) AddRegex

func (e *Engine) AddRegex(pattern, category string) error

AddRegex adds a regex pattern

func (*Engine) Redact

func (e *Engine) Redact(input []byte) ([]byte, int)

Redact scans and redacts sensitive data from the input

func (*Engine) RedactWithMatches

func (e *Engine) RedactWithMatches(input []byte) ([]byte, []Match)

RedactWithMatches scans and redacts sensitive data, returning detailed match information for this run. Note: matches.Original contains the original hit content; callers that display it in the admin UI must apply privacy settings (redaction/truncation).

type Match

type Match struct {
	Start    int
	End      int
	Original string
	Category string
	// Placeholder is the generated placeholder (e.g. "__VG_EMAIL_...").
	// It is only generated during replacement; used for audit/inspection displays that need to show redaction hits.
	Placeholder string
}

Match represents a detected sensitive data match

type Redactor added in v0.2.0

type Redactor interface {
	RedactWithMatches(input []byte) (out []byte, matches []Match)
}

Redactor is the minimal interface for a redaction engine (used by the proxy to switch implementations).

Contract: implementations must populate matches with Original/Placeholder for audit display and later restore.

Jump to

Keyboard shortcuts

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