redact

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RedactJSON

func RedactJSON(raw []byte, sensitivePaths map[string]bool) []byte

RedactJSON replaces JSON values whose paths exactly match sensitivePaths keys with the JSON string ****. Arrays reuse the parent's path segment so structs under an array resolve the same dotted paths encoding/json emits (no index in the path).

On unmarshal marshal failure returns nil so callers omit the logged body entirely.

func SensitiveFields

func SensitiveFields(typ reflect.Type) map[string]bool

SensitiveFields collects dot-separated JSON field paths declared with sensitive:"true" on structs reachable from root type typ. Root may be a pointer (e.g. *MyRequest); non-struct roots return nil.

Embedding without a JSON key name preserves the same path prefix so promoted fields align with encoding/json flattened output.

Types

This section is empty.

Jump to

Keyboard shortcuts

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