redaction

package
v1.1.41 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

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 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

Jump to

Keyboard shortcuts

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