Documentation ¶
Index ¶
- func RegisterCheck(check Check)
- type Check
- func (check *Check) IsRequiredForBlock(block *parser.Block) bool
- func (check *Check) NewResult(description string, r parser.Range, severity Severity) Result
- func (check *Check) NewResultWithValueAnnotation(description string, r parser.Range, attr *parser.Attribute, severity Severity) Result
- func (check *Check) Run(block *parser.Block, context *Context) []Result
- type Context
- type Result
- type RuleDescription
- type RuleID
- type RuleProvider
- type Scanner
- type Severity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterCheck ¶
func RegisterCheck(check Check)
RegisterCheck registers a new Check which should be run on future scans
Types ¶
type Check ¶
type Check struct { Code RuleID Description RuleDescription Provider RuleProvider RequiredTypes []string RequiredLabels []string CheckFunc func(*Check, *parser.Block, *Context) []Result }
Check is a targeted security test which can be applied to terraform templates. It includes the types to run on e.g. "resource", and the labels to run on e.g. "aws_s3_bucket".
func GetRegisteredChecks ¶
func GetRegisteredChecks() []Check
GetRegisteredChecks provides all Checks which have been registered with this package
func (*Check) IsRequiredForBlock ¶
IsRequiredForBlock returns true if the Check should be applied to the given HCL block
func (*Check) NewResult ¶
NewResult creates a new Result, containing the given description and range
func (*Check) NewResultWithValueAnnotation ¶
type Result ¶
type Result struct { RuleID RuleID `json:"rule_id"` Link string `json:"link"` Range parser.Range `json:"location"` Description string `json:"description"` RangeAnnotation string `json:"-"` Severity Severity `json:"severity"` }
Result is a positive result for a security check. It encapsulates a code unique to the specific check it was raised by, a human-readable description and a range
type RuleDescription ¶
type RuleDescription string
type RuleProvider ¶
type RuleProvider string
const ( AWSProvider RuleProvider = "aws" AzureProvider RuleProvider = "azurerm" GCPProvider RuleProvider = "google" GeneralProvider RuleProvider = "*" )