prioritization

package
v0.0.239 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 2 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControlsVector added in v0.0.180

type ControlsVector struct {
	AttackTrackName string                  `json:"attackTrackName"`
	Type            PriorityVectorType      `json:"type"`
	Vector          []PriorityVectorControl `json:"vector"`
	Score           float64                 `json:"score"`
	Severity        int                     `json:"severity"`
}

ControlsVector - list of controls which represent a priority vector

func ControlsVectorFromAttackTrackPaths added in v0.0.187

func ControlsVectorFromAttackTrackPaths(attackTrack v1alpha1.IAttackTrack, paths [][]v1alpha1.IAttackTrackStep) []ControlsVector

ControlsVectorFromAttackTrackPaths creates a list of controls vectors from a list of attack track paths

func NewControlsVector added in v0.0.180

func NewControlsVector(attackTrackName string) *ControlsVector

func (*ControlsVector) Add added in v0.0.180

func (cv *ControlsVector) Add(item interface{}) error

Add adds an item to the priority vector

func (*ControlsVector) AddControl added in v0.0.180

func (cv *ControlsVector) AddControl(control *PriorityVectorControl)

Add adds an item (PriorityVectorControl) to the priority vector

func (*ControlsVector) CalculateScore added in v0.0.187

func (cv *ControlsVector) CalculateScore(allControls map[string]v1alpha1.IAttackTrackControl, replicaCount int) (float64, error)

CalculateScore calculates the priority vector score

func (*ControlsVector) CalculateSeverity added in v0.0.187

func (cv *ControlsVector) CalculateSeverity(allControls map[string]v1alpha1.IAttackTrackControl) (int, error)

CalculateSeverity calculates the priority vector severity

func (*ControlsVector) GetIterator added in v0.0.180

func (cv *ControlsVector) GetIterator() IPriorityVectorIterator

GetIterator initialize an iterator for the priority vector

func (*ControlsVector) GetScore added in v0.0.180

func (cv *ControlsVector) GetScore() float64

GetScore get priority vector score

func (*ControlsVector) GetSeverity added in v0.0.180

func (cv *ControlsVector) GetSeverity() int

GetSeverity returns the severity of the controls vector

func (*ControlsVector) GetType added in v0.0.180

func (cv *ControlsVector) GetType() PriorityVectorType

GetType returns the priority vector type

func (*ControlsVector) IsValid added in v0.0.187

func (v *ControlsVector) IsValid() bool

A valid vector must have at least one control which is not a Security Impact-only Control

func (*ControlsVector) List added in v0.0.180

func (cv *ControlsVector) List() interface{}

List returns the priority vector

func (*ControlsVector) ListControls added in v0.0.180

func (cv *ControlsVector) ListControls() []PriorityVectorControl

ListControls returns the priority vector

func (*ControlsVector) SetScore added in v0.0.180

func (cv *ControlsVector) SetScore(score float64)

SetScore set priority vector score

func (*ControlsVector) SetSeverity added in v0.0.180

func (cv *ControlsVector) SetSeverity(severity int)

type ControlsVectorIterator added in v0.0.180

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

func (*ControlsVectorIterator) HasNext added in v0.0.180

func (iter *ControlsVectorIterator) HasNext() bool

HasNext returns true if vector has more items to iterate on

func (*ControlsVectorIterator) Len added in v0.0.180

func (iter *ControlsVectorIterator) Len() int

Len returns the length of the vector

func (*ControlsVectorIterator) Next added in v0.0.180

func (iter *ControlsVectorIterator) Next() interface{}

Next returns the next item in the vector

func (*ControlsVectorIterator) NextControl added in v0.0.180

func (iter *ControlsVectorIterator) NextControl() *PriorityVectorControl

NextControl returns the next PriorityVectorControl

type IPriorityVector added in v0.0.180

type IPriorityVector interface {
	GetType() PriorityVectorType
	GetScore() float64
	SetScore(float64)
	List() interface{}
	Add(interface{}) error
	SetSeverity(int)
	GetSeverity() int
	GetIterator() IPriorityVectorIterator
}

type IPriorityVectorIterator added in v0.0.180

type IPriorityVectorIterator interface {
	HasNext() bool
	Next() interface{}
	Len() int
}

type PrioritizedResource

type PrioritizedResource struct {
	ResourceID     string           `json:"resourceID"`
	PriorityVector []ControlsVector `json:"priorityVector"`
	Score          float64          `json:"score"`
	Severity       int              `json:"severity"`
}

PrioritizedResource - resource with a score based on its priority vectors

func (*PrioritizedResource) CalculateScore added in v0.0.180

func (pr *PrioritizedResource) CalculateScore() float64

CalculateScore calculates resource score, which is a sum of its priority vectors scores

func (*PrioritizedResource) CalculateSeverity added in v0.0.180

func (pr *PrioritizedResource) CalculateSeverity() int

CalculateSeverity calculates resource severity, which is the max severity of its priority vectors scores

func (*PrioritizedResource) GetResourceID

func (pr *PrioritizedResource) GetResourceID() string

GetResourceID get the resource ID

func (*PrioritizedResource) GetScore

func (pr *PrioritizedResource) GetScore() float64

GetScore returns the score of the prioritized resource

func (*PrioritizedResource) GetSeverity added in v0.0.180

func (pr *PrioritizedResource) GetSeverity() int

func (*PrioritizedResource) ListControlsIDs

func (pr *PrioritizedResource) ListControlsIDs() []string

ListControlsIDs return a list of controls IDs from all priority vectors of a given resource

func (*PrioritizedResource) SetResourceID

func (pr *PrioritizedResource) SetResourceID(resourceID string)

SetResourceID set the resource ID

func (*PrioritizedResource) SetScore added in v0.0.180

func (pr *PrioritizedResource) SetScore(score float64)

SetScore updates the score of the prioritized resource

func (*PrioritizedResource) SetSeverity added in v0.0.180

func (pr *PrioritizedResource) SetSeverity(severity int)

type PriorityVectorControl added in v0.0.180

type PriorityVectorControl struct {
	ControlID string   `json:"controlID"`
	Category  string   `json:"category"`
	Tags      []string `json:"tags"`
}

type PriorityVectorType

type PriorityVectorType string
const (
	ControlPriorityVectorType PriorityVectorType = "control"
)

Jump to

Keyboard shortcuts

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