schema

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Obfuscate

type Obfuscate struct {
	// The list of domains and their subdomains which should be obfuscated in the
	// output, only used with the type Domain obfuscator.
	DomainNames []string `json:"domainNames,omitempty" yaml:"domainNames,omitempty"`

	// when replacementType 'Regex' is used, the supplied Golang regexp
	// (https://pkg.go.dev/regexp) will be used to detect the string that should be
	// replaced. The regex is line based, spanning multi-line regex statements is not
	// supported.
	Regex *string `json:"regex,omitempty" yaml:"regex,omitempty"`

	// on replacement 'Keywords', this will override a given input string with another
	// output string. On duplicate keys it will use the last defined value as
	// replacement. The input values are matched in a case-sensitive fashion and only
	// as a full words, substrings must be matched using a regex.
	Replacement ObfuscateReplacement `json:"replacement,omitempty" yaml:"replacement,omitempty"`

	// This defines how the detected string will be replaced. Type 'Consistent' will
	// guarantee the same input will always create the same output string. 'Static' is
	// used by default and will just try to mask the matching input.
	ReplacementType ObfuscateReplacementType `json:"replacementType,omitempty" yaml:"replacementType,omitempty"`

	// This determines if the obfuscation should be performed on the file path
	// (relative path from the must-gather root folder) or on the file contents. The
	// file contents are obfuscated by default.
	Target ObfuscateTarget `json:"target,omitempty" yaml:"target,omitempty"`

	// type defines the kind of detection you want to use. For example IP will find IP
	// addresses, whereas Keywords will find keywords defined in the 'replacement'
	// mapping. Domain must be used in conjunction with the 'domainNames' property,
	// that defines what domains should be obfuscated. MAC currently only supports
	// static replacement where a detected mac address will be replaced by 'x'. Regex
	// should be used with the 'regex' property that will define the regex, here the
	// replacement also will be static by 'x'-ing out the matched string.
	Type ObfuscateType `json:"type" yaml:"type"`
}

func (*Obfuscate) UnmarshalJSON

func (j *Obfuscate) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ObfuscateReplacement

type ObfuscateReplacement map[string]string

on replacement 'Keywords', this will override a given input string with another output string. On duplicate keys it will use the last defined value as replacement. The input values are matched in a case-sensitive fashion and only as a full words, substrings must be matched using a regex.

type ObfuscateReplacementType

type ObfuscateReplacementType string
const ObfuscateReplacementTypeConsistent ObfuscateReplacementType = "Consistent"
const ObfuscateReplacementTypeStatic ObfuscateReplacementType = "Static"

func (*ObfuscateReplacementType) UnmarshalJSON

func (j *ObfuscateReplacementType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ObfuscateTarget

type ObfuscateTarget string
const ObfuscateTargetAll ObfuscateTarget = "All"
const ObfuscateTargetFileContents ObfuscateTarget = "FileContents"
const ObfuscateTargetFilePath ObfuscateTarget = "FilePath"

func (*ObfuscateTarget) UnmarshalJSON

func (j *ObfuscateTarget) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ObfuscateType

type ObfuscateType string
const ObfuscateTypeDomain ObfuscateType = "Domain"
const ObfuscateTypeIP ObfuscateType = "IP"
const ObfuscateTypeKeywords ObfuscateType = "Keywords"
const ObfuscateTypeMAC ObfuscateType = "MAC"
const ObfuscateTypeRegex ObfuscateType = "Regex"

func (*ObfuscateType) UnmarshalJSON

func (j *ObfuscateType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Omit

type Omit struct {
	// KubernetesResource corresponds to the JSON schema field "kubernetesResource".
	KubernetesResource *OmitKubernetesResource `json:"kubernetesResource,omitempty" yaml:"kubernetesResource,omitempty"`

	// A file glob pattern on file paths relative to the must-gather root. The pattern
	// should be as described in https://pkg.go.dev/path/filepath#Match
	Pattern *string `json:"pattern,omitempty" yaml:"pattern,omitempty"`

	// Type corresponds to the JSON schema field "type".
	Type OmitType `json:"type" yaml:"type"`
}

func (*Omit) UnmarshalJSON

func (j *Omit) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type OmitKubernetesResource

type OmitKubernetesResource struct {
	// This defines the apiVersion of the kubernetes resource. That can be used to
	// further refine specific versions of a resource that should be omitted.
	ApiVersion *string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`

	// This defines the kind of kubernetes resource that should be omitted. This can
	// be further specified with the apiVersion and namespaces.
	Kind *string `json:"kind,omitempty" yaml:"kind,omitempty"`

	// This defines the namespaces which are supposed to be omitted. When used
	// together with kind and apiVersions, it becomes a filter. Standalone it will be
	// used as a filter for all resources in a given namespace.
	Namespaces []string `json:"namespaces,omitempty" yaml:"namespaces,omitempty"`
}

type OmitType

type OmitType string
const OmitTypeFile OmitType = "File"
const OmitTypeKubernetes OmitType = "Kubernetes"

func (*OmitType) UnmarshalJSON

func (j *OmitType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type SchemaJson

type SchemaJson struct {
	// There are two main sections, "omit" which defines the omission behaviour and
	// "obfuscate" which defines the obfuscation behaviour.
	Config SchemaJsonConfig `json:"config" yaml:"config"`
}

This configuration defines the behaviour of the must-gather-clean CLI. The CLI helps to obfuscate and omit output from OpenShift debug information ('must-gathers'). You can find more information in our GitHub repository at https://github.com/openshift/must-gather-clean.

func ReadConfigFromPath

func ReadConfigFromPath(path string) (*SchemaJson, error)

func (*SchemaJson) UnmarshalJSON

func (j *SchemaJson) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type SchemaJsonConfig

type SchemaJsonConfig struct {
	// The obfuscation schema determines what is being detected and how it is being
	// replaced. We ship with several built-in replacements for common types such as
	// IP or MAC, Keywords and Regex. The replacements are done in order of the whole
	// list, so you can define chains of replacements that built on top of one another
	// - for example replacing a keyword and later matching its replacement with a
	// regex. The input to the given replacements are always a line of text (string).
	// Since file names and directories can also have private content in them, they
	// are also processed as a line - exactly as they would with file content.
	Obfuscate []Obfuscate `json:"obfuscate,omitempty" yaml:"obfuscate,omitempty"`

	// The omission schema defines what kind of files shall not be included in the
	// final must-gather. This can be seen as a filter and can operate on file paths
	// or Kubernetes and OpenShift and other custom resources. Omissions are settled
	// first in the process of obfuscating a must-gather, so its content won't be
	// scanned and replaced.
	Omit []Omit `json:"omit,omitempty" yaml:"omit,omitempty"`
}

There are two main sections, "omit" which defines the omission behaviour and "obfuscate" which defines the obfuscation behaviour.

func (*SchemaJsonConfig) UnmarshalJSON

func (j *SchemaJsonConfig) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type UnsupportedFileTypeError

type UnsupportedFileTypeError struct {
	UsedExtension       string
	SupportedExtensions []string
}

func (UnsupportedFileTypeError) Error

func (u UnsupportedFileTypeError) Error() string

Jump to

Keyboard shortcuts

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