secretfilter

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultArguments = Arguments{}

DefaultArguments defines the default settings for log scraping.

Functions

This section is empty.

Types

type AllowRule

type AllowRule struct {
	Regex  *regexp.Regexp
	Source string
}

type Arguments

type Arguments struct {
	ForwardTo      []loki.LogsReceiver `alloy:"forward_to,attr"`
	GitleaksConfig string              `alloy:"gitleaks_config,attr,optional"` // Path to the custom gitleaks.toml file. If empty, the embedded one is used
	Types          []string            `alloy:"types,attr,optional"`           // Types of secret to look for (e.g. "aws", "gcp", ...). If empty, all types are included
	RedactWith     string              `alloy:"redact_with,attr,optional"`     // Redact the secret with this string. Use $SECRET_NAME and $SECRET_HASH to include the secret name and hash
	IncludeGeneric bool                `alloy:"include_generic,attr,optional"` // Include the generic API key rule (default: false)
	AllowList      []string            `alloy:"allowlist,attr,optional"`       // List of regexes to allowlist (on top of what's in the Gitleaks config)
	PartialMask    uint                `alloy:"partial_mask,attr,optional"`    // Show the first N characters of the secret (default: 0)
}

Arguments holds values which are used to configure the secretfilter component.

func (*Arguments) SetToDefault

func (args *Arguments) SetToDefault()

SetToDefault implements syntax.Defaulter.

type Component

type Component struct {
	Rules     []Rule
	AllowList []AllowRule
	// contains filtered or unexported fields
}

Component implements the loki.secretfilter component.

func New

func New(o component.Options, args Arguments) (*Component, error)

New creates a new loki.secretfilter component.

func (*Component) LiveDebugging

func (c *Component) LiveDebugging(_ int)

func (*Component) Run

func (c *Component) Run(ctx context.Context) error

Run implements component.Component.

func (*Component) Update

func (c *Component) Update(args component.Arguments) error

Update implements component.Component.

type Exports

type Exports struct {
	Receiver loki.LogsReceiver `alloy:"receiver,attr"`
}

Exports holds the values exported by the loki.secretfilter component.

type GitLeaksConfig

type GitLeaksConfig struct {
	AllowList struct {
		Description string
		Paths       []string
		Regexes     []string
	}
	Rules []struct {
		ID          string
		Description string
		Regex       string
		Keywords    []string
		SecretGroup int

		Allowlist struct {
			StopWords []string
			Regexes   []string
		}
	}
}

This struct is used to parse the gitleaks.toml file Non-exhaustive representation. See https://github.com/gitleaks/gitleaks/blob/master/config/config.go

This comes from the Gitleaks project by Zachary Rice, which is licensed under the MIT license. See the gitleaks.toml file for copyright and license details.

type Rule

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

Jump to

Keyboard shortcuts

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