ruler

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2019 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateInTotoLink(reports []Report, fileBytes []byte) in_toto.Metablock

Types

type InvalidInputError

type InvalidInputError struct {
}

func (*InvalidInputError) Error

func (e *InvalidInputError) Error() string

type NotSupportedError

type NotSupportedError struct {
	Kind string
}

func (*NotSupportedError) Error

func (e *NotSupportedError) Error() string

type Report

type Report struct {
	Object  string      `json:"object"`
	Valid   bool        `json:"valid"`
	Message string      `json:"message,omitempty"`
	Score   int         `json:"score"`
	Scoring RuleScoring `json:"scoring,omitempty"`
}

type Rule

type Rule struct {
	Selector  string
	Title     string
	Reason    string
	Link      string
	Kinds     []string
	Points    int
	Weight    int
	Advise    int
	Predicate func([]byte) int
}

func (*Rule) Eval

func (r *Rule) Eval(json []byte) (int, error)

Eval executes the predicate if the kind matches the rule

type RuleRef

type RuleRef struct {
	Selector   string `json:"selector"`
	Reason     string `json:"reason"`
	Weight     int    `json:"weight,omitempty"`
	Link       string `json:"href,omitempty"`
	Containers int    `json:"-"`
	Points     int    `json:"points"`
}

type RuleRefCustomOrder

type RuleRefCustomOrder []RuleRef

func (RuleRefCustomOrder) Len

func (rr RuleRefCustomOrder) Len() int

func (RuleRefCustomOrder) Less

func (rr RuleRefCustomOrder) Less(i, j int) bool

func (RuleRefCustomOrder) Swap

func (rr RuleRefCustomOrder) Swap(i, j int)

type RuleScoring

type RuleScoring struct {
	Critical []RuleRef `json:"critical,omitempty"`
	Advise   []RuleRef `json:"advise,omitempty"`
}

type Ruleset

type Ruleset struct {
	Rules []Rule
	// contains filtered or unexported fields
}

func NewRuleset

func NewRuleset(logger *zap.SugaredLogger) *Ruleset

func (*Ruleset) Run

func (rs *Ruleset) Run(fileBytes []byte) ([]Report, error)

Jump to

Keyboard shortcuts

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