engine

package
v4.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CxFileEndMarker = ";cx-file-end"
)

Variables

View Source
var (
	ErrNoRulesSelected          = fmt.Errorf("no rules were selected")
	ErrFailedToCompileRegexRule = fmt.Errorf("failed to compile regex rule")
)

Functions

func GetRulesCommand

func GetRulesCommand(engineConfig *EngineConfig) *cobra.Command

Types

type DetectorConfig added in v4.3.0

type DetectorConfig struct {
	SelectedRules         []*rules.Rule
	CustomRegexPatterns   []string
	AdditionalIgnoreRules []string
	MaxTargetMegabytes    int
}

type Engine

type Engine struct {
	Report reporting.IReport

	ScanConfig resources.ScanConfig
	// contains filtered or unexported fields
}

func (*Engine) DetectFile

func (e *Engine) DetectFile(ctx context.Context, item plugins.ISourceItem, secretsChannel chan *secrets.Secret) error

DetectFile reads the given file and detects secrets in it

func (*Engine) DetectFragment

func (e *Engine) DetectFragment(item plugins.ISourceItem, secretsChannel chan *secrets.Secret, pluginName string) error

DetectFragment detects secrets in the given fragment

func (*Engine) GetCvssScoreWithoutValidationCh added in v4.3.0

func (e *Engine) GetCvssScoreWithoutValidationCh() chan *secrets.Secret

func (*Engine) GetDetectorWorkerPool added in v4.3.0

func (e *Engine) GetDetectorWorkerPool() workerpool.Pool

func (*Engine) GetErrorsCh added in v4.3.0

func (e *Engine) GetErrorsCh() chan error

func (*Engine) GetPluginChannels added in v4.3.0

func (e *Engine) GetPluginChannels() plugins.PluginChannels

func (*Engine) GetReport added in v4.3.0

func (e *Engine) GetReport() reporting.IReport

func (*Engine) GetSecretsExtrasCh added in v4.3.0

func (e *Engine) GetSecretsExtrasCh() chan *secrets.Secret

func (*Engine) GetValidationCh added in v4.3.0

func (e *Engine) GetValidationCh() chan *secrets.Secret

func (*Engine) Scan added in v4.3.0

func (e *Engine) Scan(pluginName string)

func (*Engine) SetPluginChannels added in v4.3.0

func (e *Engine) SetPluginChannels(pluginChannels plugins.PluginChannels)

func (*Engine) Shutdown added in v4.3.0

func (e *Engine) Shutdown() error

func (*Engine) Wait added in v4.3.0

func (e *Engine) Wait()

type EngineConfig

type EngineConfig struct {
	SelectedList []string
	IgnoreList   []string
	SpecialList  []string

	MaxTargetMegabytes int

	IgnoredIds    []string
	AllowedValues []string

	DetectorWorkerPoolSize int

	CustomRegexPatterns   []string
	AdditionalIgnoreRules []string

	ScanConfig resources.ScanConfig
}

type EngineOption added in v4.3.0

type EngineOption func(*Engine)

func WithPluginChannels added in v4.3.0

func WithPluginChannels(pluginChannels plugins.PluginChannels) EngineOption

type IEngine

type IEngine interface {
	DetectFragment(item plugins.ISourceItem, secretsChannel chan *secrets.Secret, pluginName string) error
	DetectFile(ctx context.Context, item plugins.ISourceItem, secretsChannel chan *secrets.Secret) error

	GetReport() reporting.IReport

	Scan(pluginName string)
	Wait()

	GetPluginChannels() plugins.PluginChannels
	SetPluginChannels(pluginChannels plugins.PluginChannels)

	GetErrorsCh() chan error

	Shutdown() error
}

func Init

func Init(engineConfig *EngineConfig, opts ...EngineOption) (IEngine, error)

type IScorer added in v4.3.0

type IScorer interface {
	Score(secret *secrets.Secret)
	GetRulesBaseRiskScore(ruleId string) float64
	GetKeywords() map[string]struct{}
	GetRulesToBeApplied() map[string]config.Rule
}

Directories

Path Synopsis
Package chunk is a generated GoMock package.
Package chunk is a generated GoMock package.
Package semaphore is a generated GoMock package.
Package semaphore is a generated GoMock package.

Jump to

Keyboard shortcuts

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