redaction

package
v1.1.74 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGlobalRedactionCfg = errors.New(1510, "the global redaction config has not been initialized")
	ErrInvalidRegex       = errors.Newf(1511, "could not compile the %s regex value (%v): %v")
)

Config errors

Functions

func JMSPropertiesRedaction

func JMSPropertiesRedaction(properties map[string]string) (map[string]string, error)

JMSPropertiesRedaction - accepts a map of response headers and returns the redacted and sanitize map

func PathRedaction

func PathRedaction(path string) (string, error)

PathRedaction - returns a string that has only allowed path elements

func QueryArgsRedaction

func QueryArgsRedaction(args map[string][]string) (map[string][]string, error)

QueryArgsRedaction - accepts a string for arguments and returns the same string with redacted

func QueryArgsRedactionString

func QueryArgsRedactionString(args string) (string, error)

QueryArgsRedactionString - accepts a string for arguments and returns the same string with redacted

func RequestHeadersRedaction

func RequestHeadersRedaction(headers map[string]string) (map[string]string, error)

RequestHeadersRedaction - accepts a map of response headers and returns the redacted and sanitize map

func ResponseHeadersRedaction

func ResponseHeadersRedaction(headers map[string]string) (map[string]string, error)

ResponseHeadersRedaction - accepts a map of response headers and returns the redacted and sanitize map

func SetupGlobalRedaction

func SetupGlobalRedaction(cfg Config) error

SetupGlobalRedaction - set up redactionRegex based on the redactionConfig

func URIRedaction

func URIRedaction(fullURI string) (string, error)

URIRedaction - takes a uri and returns the redacted version of that URI

Types

type Config

type Config struct {
	Path              Path   `config:"path" yaml:"path"`
	Args              Filter `config:"queryArgument" yaml:"queryArgument"`
	RequestHeaders    Filter `config:"requestHeader" yaml:"requestHeader"`
	ResponseHeaders   Filter `config:"responseHeader" yaml:"responseHeader"`
	MaskingCharacters string `config:"maskingCharacters" yaml:"maskingCharacters"`
	JMSProperties     Filter `config:"jmsProperties" yaml:"jmsProperties"`
}

Config - the configuration of all redactions

func DefaultConfig

func DefaultConfig() Config

DefaultConfig - returns a default reaction config where all things are redacted

func (*Config) SetupRedactions

func (cfg *Config) SetupRedactions() (Redactions, error)

SetupRedactions - set up redactionRegex based on the redactionConfig

type Filter added in v1.1.58

type Filter struct {
	Allowed  []Show     `config:"show" yaml:"show"`
	Sanitize []Sanitize `config:"sanitize" yaml:"sanitize"`
}

filter - the configuration of a filter for each redaction config

type Path added in v1.1.58

type Path struct {
	Allowed []Show `config:"show" yaml:"show"`
}

path - the keyMatches to show, all else are redacted

type Redactions

type Redactions interface {
	URIRedaction(uri string) (string, error)
	PathRedaction(path string) string
	QueryArgsRedaction(queryArgs map[string][]string) (map[string][]string, error)
	QueryArgsRedactionString(queryArgs string) (string, error)
	RequestHeadersRedaction(requestHeaders map[string]string) (map[string]string, error)
	ResponseHeadersRedaction(responseHeaders map[string]string) (map[string]string, error)
	JMSPropertiesRedaction(jmsProperties map[string]string) (map[string]string, error)
}

Redactions - the public methods available for redaction config

type Sanitize added in v1.1.58

type Sanitize struct {
	KeyMatch   string `config:"keyMatch" yaml:"keyMatch"`
	ValueMatch string `config:"valueMatch" yaml:"valueMatch"`
}

sanitize - the keys and values to sanitize

type Show added in v1.1.58

type Show struct {
	KeyMatch string `config:"keyMatch" yaml:"keyMatch"`
}

show - the keyMatches to show, all else are redacted

Jump to

Keyboard shortcuts

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