scan

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package scan contains implementation and logic for running scans using pre-defined policies against specified targets.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("policy not found")

Functions

func EvaluateMany

func EvaluateMany(targets []*Target, resultChan chan *Result, errorChan chan error)

EvaluateMany policies concurrently - // TODO: WEP

Types

type Result

type Result struct {
	Suggestions []string
	Violations  []Rule
}

Result - stores result of scan evaluation

func FindPolicyAndEvaluate

func FindPolicyAndEvaluate(target *Target) (result *Result, err error)

FindPolicyAndEvaluate -

type Rule

type Rule struct {
	Level          uint32 `json:"level"`
	Message        string `json:"message"`
	RuleID         string `json:"ruleID"`
	RuleDefinition string `json:"ruleDef"`
}

Rule - type used to unmarshal Rego Policy violations[rule]

func (Rule) String

func (r Rule) String() string

type Target

type Target struct {
	ResourceType string
	Platform     string
	Item         interface{}
	// contains filtered or unexported fields
}

Target - struct represents the entity/element to be scanned/evaluated

func NewTarget

func NewTarget(item interface{}, platform, resourcetype string) *Target

NewTarget - returns a pointer an instance of scan.Target

func (*Target) AddSubGrouping

func (t *Target) AddSubGrouping(groups ...string) *Target

AddSubGrouping - adds a sub group subgroups are used by some resources that require additional partition beyond platform --> resource Note that subgroups are placed between platform & resource during lookups, i.e platform --> [subgroups] --> resource or kubernetes --> app/v1 --> resource

Jump to

Keyboard shortcuts

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