v1alpha1

package
v0.0.283 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 3 Imported by: 11

Documentation

Index

Constants

View Source
const (
	ControlTypeTagDevops           string = "devops"
	ControlTypeTagSecurity         string = "security"
	ControlTypeTagCompliance       string = "compliance"
	ControlTypeTagSecurityImpact   string = "security-impact"
	ControlTypeTagSmartRemediation string = "smartRemediation"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AttackTrack

type AttackTrack struct {
	ApiVersion string                   `json:"apiVersion"`
	Kind       string                   `json:"kind"`
	Metadata   map[string]interface{}   `json:"metadata"`
	Spec       AttackTrackSpecification `json:"spec"`
}

func (*AttackTrack) GetApiVersion

func (at *AttackTrack) GetApiVersion() string

func (*AttackTrack) GetData

func (at *AttackTrack) GetData() IAttackTrackStep

func (*AttackTrack) GetDescription

func (at *AttackTrack) GetDescription() string

func (*AttackTrack) GetKind

func (at *AttackTrack) GetKind() string

func (*AttackTrack) GetName

func (at *AttackTrack) GetName() string

func (*AttackTrack) GetSubstepsWithVulnerabilities added in v0.0.254

func (at *AttackTrack) GetSubstepsWithVulnerabilities() []string

GetSubstepsWithVulnerabilities returns a list of substeps names that check for vulnerabilities

func (*AttackTrack) GetVersion

func (at *AttackTrack) GetVersion() string

func (*AttackTrack) IsValid

func (at *AttackTrack) IsValid() bool

IsValid returns true if an attack track is valid

func (*AttackTrack) Iterator

func (at *AttackTrack) Iterator() IAttackTrackIterator

==================== Iterator ====================

type AttackTrackAllPathsHandler

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

func NewAttackTrackAllPathsHandler

func NewAttackTrackAllPathsHandler(attackTrack IAttackTrack, lookup IAttackTrackControlsLookup) *AttackTrackAllPathsHandler

func (*AttackTrackAllPathsHandler) CalculateAllPaths

func (handler *AttackTrackAllPathsHandler) CalculateAllPaths() [][]IAttackTrackStep

func (*AttackTrackAllPathsHandler) CalculatePathsRootToLeaf added in v0.0.251

func (handler *AttackTrackAllPathsHandler) CalculatePathsRootToLeaf() [][]IAttackTrackStep

func (*AttackTrackAllPathsHandler) GenerateAttackTrackFromPaths added in v0.0.251

func (handler *AttackTrackAllPathsHandler) GenerateAttackTrackFromPaths(paths [][]IAttackTrackStep) *AttackTrack

GenerateAttackTrackFromPaths - generates a new attack track from the given paths The new attack track will contain only nodes that have controls

type AttackTrackControlMock

type AttackTrackControlMock struct {
	ControlId  string
	Categories []string
	Tags       []string
	BaseScore  float64
	Severity   int
}

func (*AttackTrackControlMock) GetAttackTrackCategories

func (mock *AttackTrackControlMock) GetAttackTrackCategories(x string) []string

func (*AttackTrackControlMock) GetControlId

func (mock *AttackTrackControlMock) GetControlId() string

func (*AttackTrackControlMock) GetControlTypeTags

func (mock *AttackTrackControlMock) GetControlTypeTags() []string

func (*AttackTrackControlMock) GetScore

func (mock *AttackTrackControlMock) GetScore() float64

func (*AttackTrackControlMock) GetSeverity

func (mock *AttackTrackControlMock) GetSeverity() int

type AttackTrackControlsLookup

type AttackTrackControlsLookup map[string]map[string][]IAttackTrackControl

func NewAttackTrackControlsLookup

func NewAttackTrackControlsLookup(attackTracks []IAttackTrack, failedControlIds []string, allControls map[string]IAttackTrackControl) AttackTrackControlsLookup

func (*AttackTrackControlsLookup) GetAssociatedControls

func (at *AttackTrackControlsLookup) GetAssociatedControls(attackTrack, category string) []IAttackTrackControl

func (*AttackTrackControlsLookup) HasAssociatedControls

func (at *AttackTrackControlsLookup) HasAssociatedControls(attackTrack string) bool

type AttackTrackIterator

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

func (*AttackTrackIterator) HasNext

func (iter *AttackTrackIterator) HasNext() bool

func (*AttackTrackIterator) Next

type AttackTrackMock

type AttackTrackMock struct {
	Kind       string                       `json:"kind"`
	ApiVersion string                       `json:"apiVersion"`
	Metadata   map[string]interface{}       `json:"metadata"`
	Spec       MockAttackTrackSpecification `json:"spec"`
}

Mocked AttackTrack implementation for testing

func (AttackTrackMock) GetApiVersion added in v0.0.251

func (at AttackTrackMock) GetApiVersion() string

func (AttackTrackMock) GetData added in v0.0.251

func (a AttackTrackMock) GetData() IAttackTrackStep

Mocked AttackTrack methods

func (AttackTrackMock) GetDescription added in v0.0.251

func (at AttackTrackMock) GetDescription() string

func (AttackTrackMock) GetKind added in v0.0.251

func (at AttackTrackMock) GetKind() string

func (AttackTrackMock) GetName added in v0.0.251

func (at AttackTrackMock) GetName() string

func (AttackTrackMock) GetSubstepsWithVulnerabilities added in v0.0.254

func (at AttackTrackMock) GetSubstepsWithVulnerabilities() []string

GetSubstepsWithVulnerabilities returns a list of substeps names that check for vulnerabilities

func (AttackTrackMock) GetVersion added in v0.0.251

func (at AttackTrackMock) GetVersion() string

func (AttackTrackMock) IsValid added in v0.0.251

func (at AttackTrackMock) IsValid() bool

IsValid returns true if an attack track is valid

func (AttackTrackMock) Iterator added in v0.0.251

func (at AttackTrackMock) Iterator() IAttackTrackIterator

type AttackTrackSpecification

type AttackTrackSpecification struct {
	Version     string          `json:"version,omitempty"`
	Description string          `json:"description,omitempty"`
	Data        AttackTrackStep `json:"data"`
}

type AttackTrackStep

type AttackTrackStep struct {
	Name                  string            `json:"name"`
	Description           string            `json:"description,omitempty"`
	ChecksVulnerabilities bool              `json:"checksVulnerabilities,omitempty"`
	SubSteps              []AttackTrackStep `json:"subSteps,omitempty"`

	// failed controls which are related to this step
	Controls []IAttackTrackControl `json:"-"`
}

func (*AttackTrackStep) DoesCheckVulnerabilities added in v0.0.252

func (step *AttackTrackStep) DoesCheckVulnerabilities() bool

func (*AttackTrackStep) Equal added in v0.0.251

func (s *AttackTrackStep) Equal(other *AttackTrackStep, compareControls bool) bool

Equal checks if the given attack track step is equal to the current one If compareControls is true, the controls are also compared

func (*AttackTrackStep) GetControls

func (step *AttackTrackStep) GetControls() []IAttackTrackControl

func (*AttackTrackStep) GetDescription

func (step *AttackTrackStep) GetDescription() string

func (*AttackTrackStep) GetName

func (step *AttackTrackStep) GetName() string

func (*AttackTrackStep) IsLeaf added in v0.0.251

func (step *AttackTrackStep) IsLeaf() bool

func (*AttackTrackStep) IsPartOfAttackTrackPath

func (step *AttackTrackStep) IsPartOfAttackTrackPath() bool

IsPartOfAttackTrackPath checks if the step can be a part of an attack track path (i.e. step has failed controls)

func (*AttackTrackStep) Length

func (step *AttackTrackStep) Length() int

func (*AttackTrackStep) SetControls

func (step *AttackTrackStep) SetControls(controls []IAttackTrackControl)

func (*AttackTrackStep) SubStepAt

func (step *AttackTrackStep) SubStepAt(index int) IAttackTrackStep

type AttackTrackStepMock added in v0.0.251

type AttackTrackStepMock struct {
	Name                  string
	Description           string
	ChecksVulnerabilities bool
	SubSteps              []AttackTrackStepMock
	Controls              []IAttackTrackControl
}

Mocked AttackTrackStep implementation for testing

func (AttackTrackStepMock) DoesCheckVulnerabilities added in v0.0.252

func (s AttackTrackStepMock) DoesCheckVulnerabilities() bool

func (AttackTrackStepMock) GetControls added in v0.0.251

func (s AttackTrackStepMock) GetControls() []IAttackTrackControl

func (AttackTrackStepMock) GetDescription added in v0.0.251

func (s AttackTrackStepMock) GetDescription() string

func (AttackTrackStepMock) GetName added in v0.0.251

func (s AttackTrackStepMock) GetName() string

Mocked AttackTrackStep methods

func (AttackTrackStepMock) IsLeaf added in v0.0.251

func (s AttackTrackStepMock) IsLeaf() bool

func (AttackTrackStepMock) IsPartOfAttackTrackPath added in v0.0.251

func (a AttackTrackStepMock) IsPartOfAttackTrackPath() bool

func (AttackTrackStepMock) Length added in v0.0.251

func (s AttackTrackStepMock) Length() int

func (AttackTrackStepMock) SetControls added in v0.0.251

func (s AttackTrackStepMock) SetControls(controls []IAttackTrackControl)

func (AttackTrackStepMock) SubStepAt added in v0.0.251

func (s AttackTrackStepMock) SubStepAt(index int) IAttackTrackStep

type IAttackTrack

type IAttackTrack interface {
	GetApiVersion() string
	GetKind() string
	GetName() string
	GetDescription() string
	GetVersion() string
	GetData() IAttackTrackStep
	Iterator() IAttackTrackIterator
	IsValid() bool
	GetSubstepsWithVulnerabilities() []string
}

func GetAttackTrackMock added in v0.0.251

func GetAttackTrackMock(data AttackTrackStep) IAttackTrack

type IAttackTrackControl

type IAttackTrackControl interface {
	GetAttackTrackCategories(attackTrack string) []string
	GetControlTypeTags() []string
	GetControlId() string
	GetScore() float64
	GetSeverity() int
}

A control related to an attack track step

type IAttackTrackControlsLookup

type IAttackTrackControlsLookup interface {
	// returns a list of controls associated with the given attack track and category
	GetAssociatedControls(attackTrack, category string) []IAttackTrackControl

	// returns true if attack track as any associated controls
	HasAssociatedControls(attackTrack string) bool
}

type IAttackTrackIterator

type IAttackTrackIterator interface {
	HasNext() bool
	Next() IAttackTrackStep
}

Iterator interface for iterating over the attack track's steps

type IAttackTrackStep

type IAttackTrackStep interface {
	GetName() string                            // returns the name of the step
	GetDescription() string                     // returns the description of the step
	GetControls() []IAttackTrackControl         // returns the list of controls which failed on this step
	SetControls(controls []IAttackTrackControl) // sets the list of controls which failed on this step
	Length() int                                // returns the number of sub steps
	SubStepAt(index int) IAttackTrackStep       // returns a sub step at the given index
	IsPartOfAttackTrackPath() bool              // checks if the step can be a part of an attack track path
	IsLeaf() bool                               // checks if the step is a leaf node
	DoesCheckVulnerabilities() bool             // checks if the step checks for vulnerabilities
}

A step in an attack track

type MockAttackTrackSpecification added in v0.0.251

type MockAttackTrackSpecification struct {
	Version     string           `json:"version,omitempty"`
	Description string           `json:"description,omitempty"`
	Data        IAttackTrackStep `json:"data"`
}

Jump to

Keyboard shortcuts

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