sds

package module
v0.61.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

View Source
const SDSEnabled = false

Variables

This section is empty.

Functions

func ShouldBlockCollectionUntilSDSConfiguration added in v0.58.0

func ShouldBlockCollectionUntilSDSConfiguration(cfg pkgconfigmodel.Reader) bool

ShouldBlockCollectionUntilSDSConfiguration returns true if we want to start the collection only after having received an SDS configuration.

func ShouldBufferUntilSDSConfiguration added in v0.58.0

func ShouldBufferUntilSDSConfiguration(cfg pkgconfigmodel.Reader) bool

ShouldBufferUntilSDSConfiguration returns true if we have to buffer until we've received an SDS configuration.

func ValidateConfigField added in v0.58.0

func ValidateConfigField(cfg pkgconfigmodel.Reader) error

ValidateConfigField returns true if the configuration value for wait_for_configuration is valid. Validates its value only when SDS is enabled.

func WaitForConfigurationBufferMaxSize added in v0.58.0

func WaitForConfigurationBufferMaxSize(cfg pkgconfigmodel.Reader) int

WaitForConfigurationBufferMaxSize returns a size for the buffer used while waiting for an SDS configuration.

Types

type Match

type Match struct {
	RuleIdx uint32
}

Match mock.

type MatchAction

type MatchAction struct {
	Type           string `json:"type"`
	Placeholder    string `json:"placeholder"`
	Direction      string `json:"direction"`
	CharacterCount uint32 `json:"character_count"`
}

MatchAction defines what's the action to do when there is a match.

type ProximityKeywords

type ProximityKeywords struct {
	Keywords               []string `json:"keywords"`
	CharacterCount         uint32   `json:"character_count"`
	UseRecommendedKeywords bool     `json:"use_recommended_keywords"`
}

ProximityKeywords definition in RC config.

type ReconfigureOrder

type ReconfigureOrder struct {
	Type         ReconfigureOrderType
	Config       []byte
	ResponseChan chan ReconfigureResponse
}

ReconfigureOrder are used to trigger a reconfiguration of the SDS scanner.

type ReconfigureOrderType

type ReconfigureOrderType string
const (
	// StandardRules triggers the storage of a new set of standard rules
	// and reconfigure the internal SDS scanner with an existing user
	// configuration if any.
	StandardRules ReconfigureOrderType = "standard_rules"
	// AgentConfig triggers a reconfiguration of the SDS scanner.
	AgentConfig ReconfigureOrderType = "agent_config"
	// StopProcessing triggers a reconfiguration of the SDS scanner by destroying
	// it to remove the SDS processing step.
	StopProcessing ReconfigureOrderType = "stop_processing"
)

type ReconfigureResponse added in v0.58.0

type ReconfigureResponse struct {
	Err      error
	IsActive bool
}

ReconfigureResponse is used to transmit the result from reconfiguring the processors.

type RuleConfig

type RuleConfig struct {
	ID               string            `json:"id"`
	Name             string            `json:"name"`
	Description      string            `json:"description"`
	Tags             []string          `json:"tags"`
	Definition       RuleDefinition    `json:"definition"`
	MatchAction      MatchAction       `json:"match_action"`
	IncludedKeywords ProximityKeywords `json:"included_keywords"`
	IsEnabled        bool              `json:"is_enabled"`
}

RuleConfig of rule as sent by the Remote Configuration.

type RuleDefinition

type RuleDefinition struct {
	StandardRuleID string `json:"standard_rule_id"`
	Pattern        string `json:"pattern"`
}

RuleDefinition definition in RC config.

type RulesConfig

type RulesConfig struct {
	ID          string       `json:"id"`
	Name        string       `json:"name"`
	Rules       []RuleConfig `json:"rules"`
	IsEnabled   bool         `json:"is_enabled"`
	Description string       `json:"description"`
}

RulesConfig as sent by the Remote Configuration. Equivalent of the groups in the UI.

func (RulesConfig) OnlyEnabled

func (r RulesConfig) OnlyEnabled() RulesConfig

OnlyEnabled returns a new RulesConfig object containing only enabled rules. Use this to filter out disabled rules.

type Scanner

type Scanner struct {
}

Scanner mock.

func CreateScanner

func CreateScanner(_ string) *Scanner

CreateScanner creates a scanner for unsupported platforms/architectures.

func (*Scanner) Delete

func (s *Scanner) Delete()

Delete mocks the Delete function.

func (*Scanner) GetRuleByIdx

func (s *Scanner) GetRuleByIdx(_ uint32) (RuleConfig, error)

GetRuleByIdx mocks the GetRuleByIdx function.

func (*Scanner) IsReady

func (s *Scanner) IsReady() bool

IsReady mocks the IsReady function.

func (*Scanner) Reconfigure

func (s *Scanner) Reconfigure(_ ReconfigureOrder) (bool, error)

Reconfigure mocks the Reconfigure function.

func (*Scanner) Scan

func (s *Scanner) Scan(_ []byte, _ *message.Message) (bool, []byte, error)

Scan mocks the Scan function.

type StandardRuleConfig

type StandardRuleConfig struct {
	ID          string                   `json:"id"`
	Name        string                   `json:"name"`
	Tags        []string                 `json:"tags"`
	Description string                   `json:"description"`
	Definitions []StandardRuleDefinition `json:"definitions"`
}

StandardRuleConfig as sent by the Remote Configuration;

type StandardRuleDefinition

type StandardRuleDefinition struct {
	Version                 int      `json:"version"`
	Pattern                 string   `json:"pattern"`
	DefaultIncludedKeywords []string `json:"default_included_keywords"`
	RequiredCapabilities    []string `json:"required_capabilities"`
}

StandardRuleDefinition contains a versioned standard rule definition.

type StandardRulesConfig

type StandardRulesConfig struct {
	Rules    []StandardRuleConfig  `json:"rules"`
	Defaults StandardRulesDefaults `json:"defaults"`
}

StandardRulesConfig contains standard rules.

type StandardRulesDefaults

type StandardRulesDefaults struct {
	IncludedKeywordsCharCount uint32   `json:"included_keywords_char_count"`
	ExcludedKeywordsCharCount uint32   `json:"excluded_keywords_char_count"`
	ExcludedKeywords          []string `json:"excluded_keywords"`
}

StandardRulesDefaults contains consts defaults information for standard rules.

Jump to

Keyboard shortcuts

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