rules

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmbeddedPolicyFileSystem embed.FS

Functions

func Deregister added in v0.17.4

func Deregister(rule RegisteredRule)

Types

type CheckFunc

type CheckFunc func(s *state.State) (results Results)

type CustomChecks added in v0.17.3

type CustomChecks struct {
	Terraform *TerraformCustomCheck
}

type EngineMetadata added in v0.3.0

type EngineMetadata struct {
	GoodExamples        []string `json:"good_examples,omitempty"`
	BadExamples         []string `json:"bad_examples,omitempty"`
	RemediationMarkdown string   `json:"remediation_markdown,omitempty"`
	Links               []string `json:"links,omitempty"`
}

type FlatRange

type FlatRange struct {
	Filename  string `json:"filename"`
	StartLine int    `json:"start_line"`
	EndLine   int    `json:"end_line"`
}

type FlatResult

type FlatResult struct {
	RuleID          string             `json:"rule_id"`
	LongID          string             `json:"long_id"`
	RuleSummary     string             `json:"rule_description"`
	RuleProvider    providers.Provider `json:"rule_provider"`
	RuleService     string             `json:"rule_service"`
	Impact          string             `json:"impact"`
	Resolution      string             `json:"resolution"`
	Links           []string           `json:"links"`
	Description     string             `json:"description"`
	RangeAnnotation string             `json:"-"`
	Severity        severity.Severity  `json:"severity"`
	Status          Status             `json:"status"`
	Resource        string             `json:"resource"`
	Location        FlatRange          `json:"location"`
}

type MetadataProvider

type MetadataProvider interface {
	GetMetadata() types.Metadata
	GetRawValue() interface{}
}

type RegisteredRule

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

func GetRegistered

func GetRegistered() []RegisteredRule

func Register

func Register(rule Rule, f CheckFunc) RegisteredRule
func (r *RegisteredRule) AddLink(link string)

func (RegisteredRule) Evaluate

func (r RegisteredRule) Evaluate(s *state.State) Results

func (RegisteredRule) HasLogic added in v0.12.0

func (r RegisteredRule) HasLogic() bool

func (RegisteredRule) Rule

func (r RegisteredRule) Rule() Rule

type Result

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

func (Result) Annotation

func (r Result) Annotation() string

func (Result) Description

func (r Result) Description() string

func (*Result) Flatten

func (r *Result) Flatten() FlatResult

func (Result) Metadata added in v0.5.7

func (r Result) Metadata() types.Metadata

func (*Result) OverrideAnnotation

func (r *Result) OverrideAnnotation(annotation string)

func (*Result) OverrideDescription

func (r *Result) OverrideDescription(description string)

func (*Result) OverrideMetadata added in v0.5.7

func (r *Result) OverrideMetadata(metadata types.Metadata)

func (*Result) OverrideSeverity

func (r *Result) OverrideSeverity(s severity.Severity)

func (*Result) OverrideStatus added in v0.19.0

func (r *Result) OverrideStatus(status Status)

func (Result) Range added in v0.5.7

func (r Result) Range() types.Range

func (Result) RegoNamespace added in v0.21.0

func (r Result) RegoNamespace() string

func (Result) RegoRule added in v0.21.0

func (r Result) RegoRule() string

func (Result) Rule

func (r Result) Rule() Rule

func (Result) Severity

func (r Result) Severity() severity.Severity

func (Result) Status

func (r Result) Status() Status

type Results

type Results []Result

func (*Results) Add

func (r *Results) Add(description string, source MetadataProvider)

func (*Results) AddIgnored added in v0.19.0

func (r *Results) AddIgnored(source MetadataProvider, descriptions ...string)

func (*Results) AddPassed

func (r *Results) AddPassed(source MetadataProvider, descriptions ...string)

func (*Results) AddRego added in v0.21.0

func (r *Results) AddRego(description string, namespace string, rule string, source MetadataProvider)

func (Results) Flatten

func (r Results) Flatten() []FlatResult

func (*Results) GetFailed added in v0.19.0

func (r *Results) GetFailed() Results

func (*Results) GetIgnored added in v0.19.0

func (r *Results) GetIgnored() Results

func (*Results) GetPassed added in v0.19.0

func (r *Results) GetPassed() Results

func (*Results) SetRule

func (r *Results) SetRule(rule Rule)

type Rule

type Rule struct {
	AVDID          string             `json:"avd_id"`
	LegacyID       string             `json:"id"`
	ShortCode      string             `json:"short_code"`
	Summary        string             `json:"summary"`
	Explanation    string             `json:"explanation"`
	Impact         string             `json:"impact"`
	Resolution     string             `json:"resolution"`
	Provider       providers.Provider `json:"provider"`
	Service        string             `json:"service"`
	Links          []string           `json:"links"`
	Severity       severity.Severity  `json:"severity"`
	Terraform      *EngineMetadata    `json:"terraform,omitempty"`
	CloudFormation *EngineMetadata    `json:"cloud_formation,omitempty"`
	CustomChecks   CustomChecks       `json:"-"`
	RegoPackage    string             `json:"-"`
}

func (Rule) LongID

func (r Rule) LongID() string

func (Rule) ServiceDisplayName added in v0.3.6

func (r Rule) ServiceDisplayName() string

func (Rule) ShortCodeDisplayName added in v0.3.6

func (r Rule) ShortCodeDisplayName() string

type Status

type Status uint8
const (
	StatusFailed Status = iota
	StatusPassed
	StatusIgnored
)

type TerraformCustomCheck added in v0.17.3

type TerraformCustomCheck struct {
	RequiredTypes   []string
	RequiredLabels  []string
	RequiredSources []string
	Check           func(*terraform.Block, *terraform.Module) Results
}

Jump to

Keyboard shortcuts

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