policy

package
v0.5.26 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Terraform      = Target("terraform")
	TerraformPlan  = Target("terraform-plan")
	Cloudformation = Target("cloudformation")
	Kubernetes     = Target("kubernetes")
	Helm           = Target("helm")
	Docker         = Target("docker")
	Secrets        = Target("secrets")
	None           = Target("")
)

Variables

This section is empty.

Functions

func RegisterRuleType added in v0.5.23

func RegisterRuleType(ruleType RuleType)

Types

type Manager

type Manager struct {
	tools.RunOpts
	Dir   string
	Rules map[RuleType][]*Rule
}

func (*Manager) CreateTarBall

func (m *Manager) CreateTarBall(path string) error

func (*Manager) DetectPolicy added in v0.5.23

func (m *Manager) DetectPolicy() error

Finds and loads rules in a directory. The directory may be any directory in the policies tree. Only rules underneath the directory will be loaded. Policy directories have the following layout:

policies/ policies/<rule-tyoe> policies/<rule-type>/<rule> (must contain metadata.yaml) policies/<rule-type>/<rule>/<target>

<target> is optional depending on <rule-type>.

func (*Manager) LoadRules

func (m *Manager) LoadRules() error

func (*Manager) PrepareRules

func (m *Manager) PrepareRules(dest string) error

func (*Manager) Register added in v0.5.23

func (m *Manager) Register(cmd *cobra.Command)

func (*Manager) RuleCount added in v0.5.24

func (m *Manager) RuleCount() (count int)

func (*Manager) TestRules

func (m *Manager) TestRules() (TestMetrics, error)

func (*Manager) ValidateRules

func (m *Manager) ValidateRules() (ValidateMetrics, error)

type PassFail

type PassFail *bool

type Rule

type Rule struct {
	ID       string
	Path     string
	Metadata map[string]interface{}
	Targets  []Target
}

type RuleType

type RuleType interface {
	GetName() string
	GetCode() string
	PrepareRules(m *Manager, rules []*Rule, dest string) error
	ValidateRules(m *Manager, rules []*Rule) error
	GetTestRunner(m *Manager, target Target) tools.Single
	FindRuleResult(findings assessments.Findings, id string) PassFail
}

func GetRuleType added in v0.5.23

func GetRuleType(ruleTypeName string) RuleType

type Target

type Target string

type TestMetrics added in v0.5.23

type TestMetrics struct {
	FailureCount int
	TestCount    int
}

type ValidateMetrics added in v0.5.23

type ValidateMetrics struct {
	Count int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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