verify

package
v0.4.12 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: GPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CheckAdditional is used to record additional information
	CheckAdditional = color.New(color.FgWhite, color.Faint)
	// CheckDetail is the color for detail on a check
	CheckDetail = color.Set(color.FgHiWhite, color.Faint)
	// CheckTitle is the color for the title of a check
	CheckTitle = color.Set(color.Bold)
)
View Source
var (
	// PassedStatus is the status for a passed messages
	PassedStatus = "PASSED"
	// FailedStatus is the status for a failed messages
	FailedStatus = "FAILED"
	// SkippedStatus is the status for a skipped messages
	SkippedStatus = "SKIPPED"
	// WarningStatus is the status for a warning messages
	WarningStatus = "WARNING"
	// InfoStatus is the status for a informational purposes
	InfoStatus = "INFO"
)
View Source
var (
	// SeverityCritical is the severity for a critical check
	SeverityCritical = "CRITICAL"
	// SeverityWarning is the severity for a warning check
	SeverityWarning = "WARNING"
	// SeverityHigh is the severity for a high check
	SeverityHigh = "HIGH"
	// SeverityLow is the severity for a low check
	SeverityLow = "LOW"
)

Functions

func NewCommand

func NewCommand(factory cmd.Factory) *cobra.Command

NewCommand creates and returns a new command

func NewRevisionCommand

func NewRevisionCommand(factory cmd.Factory) *cobra.Command

NewRevisionCommand creates a new command

Types

type Check

type Check struct {
	// Severity is the severity of the check
	Severity string `json:"severity"`
	// Status is the status of the check
	Status string `yaml:"status"`
	// Detail is the detail of the check
	Detail string `yaml:"detail"`
}

Check is a check which has been ran

type CheckGroup

type CheckGroup struct {
	// Title is the title of the check group
	Title string
	// Checks is a collection of checks ran against the title
	Checks []Check
}

CheckGroup is a group of checks under a common title

type CheckInterface

type CheckInterface interface {
	// Additional is purely for informational purposes
	Additional(detail string, args ...interface{})
	// Info is purely for informational purposes
	Info(detail string, args ...interface{})
	// Passed adds a passed result to the check
	Passed(detail string, args ...interface{})
	// Failed adds a failed result to the check
	Failed(detail string, args ...interface{})
	// Skipped adds an ignored result to the check
	Skipped(detail string, args ...interface{})
	// Warning adds an ignored result to the check
	Warning(detail string, args ...interface{})
}

CheckInterface is the interface for a check

type CheckResult

type CheckResult struct {
	// Writer is the writer to write the result to
	Writer io.Writer
	// Groups is a collection of checks
	Groups []*CheckGroup
}

CheckResult is the result of a series of checks

func NewCheckResult

func NewCheckResult(wr io.Writer) *CheckResult

NewCheckResult creates a new check result

func (*CheckResult) Check

func (c *CheckResult) Check(title string, call func(o CheckInterface) error) error

Check is responsible for recording one or more results against the area

func (*CheckResult) FailedCount

func (c *CheckResult) FailedCount() int

FailedCount returns the number of failed checks

func (*CheckResult) GetGroup

func (c *CheckResult) GetGroup(title string) (*CheckGroup, bool)

GetGroup returns true if the group exists

func (*CheckResult) PassedCount

func (c *CheckResult) PassedCount() int

PassedCount returns the number of passed checks

func (*CheckResult) StatusCount

func (c *CheckResult) StatusCount(status string) int

StatusCount returns the number of checks with the given status

func (*CheckResult) WarningCount

func (c *CheckResult) WarningCount() int

WarningCount returns the number of warnings

type RevisionCommand

type RevisionCommand struct {
	cmd.Factory
	// File is the path to the file to verify
	File string
	// SourceDir is the directory used to include additional files
	SourceDir string
	// CheckovImage is the version of checkov image to use when validating the security policy
	CheckovImage string
	// TerraformImage is the version of terraform to use when validating the security policy
	TerraformImage string
	// Directory is the temporary directory used to store the converted files
	Directory string
	// EnableCluster indicates we should not retrieve configuration from the current kubeconfig
	EnableCluster bool
	// EnableTerraformPlan indicates we should use a terraform plan to verify the security policy.
	// Note, this does require credentials to be configured
	EnableTerraformPlan bool
	// Contexts is a list of contexts from the cluster
	Contexts *terraformv1alpha1.ContextList
	// Policies is a list of policies from the cluster
	Policies *terraformv1alpha1.PolicyList
	// Providers is a collection of providers in the cluster
	Providers *terraformv1alpha1.ProviderList
	// Check is a collection of checks we performed
	Verify *CheckResult
	// KeepTempDir indicates we should not remove the temporary directory
	KeepTempDir bool
}

RevisionCommand are the options for the command

func (*RevisionCommand) Run

func (o *RevisionCommand) Run(ctx context.Context) error

Run runs the command

Jump to

Keyboard shortcuts

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