Documentation
¶
Index ¶
- Variables
- type BanditCWE
- type BanditOut
- type BanditResult
- type BanditTransformer
- type BanditTransformerOption
- func BanditRawOutFileContents(contents []byte) BanditTransformerOption
- func BanditRawOutFilePath(path string) BanditTransformerOption
- func BanditTransformerWithClock(clock clockwork.Clock) BanditTransformerOption
- func BanditTransformerWithTarget(target ocsffindinginfo.DataSource_TargetType) BanditTransformerOption
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNilClock is thrown when the option setclock is called with empty clock ErrNilClock = errors.Errorf("invalid nil clock") // ErrEmptyTarget is thrown when the option set target is called with empty target ErrEmptyTarget = errors.Errorf("invalid empty target") // ErrEmptyRawOutfilePath is thrown when the option raw outfile path is called with empty path ErrEmptyRawOutfilePath = errors.Errorf("invalid raw out file path") // ErrEmptyRawOutfileContents is thrown when the option raw outfile contents is called with empty contents ErrEmptyRawOutfileContents = errors.Errorf("empty raw out file contents") // ErrBadTargetType is thrown when the option set target type is called with an unspecified or empty target type ErrBadTargetType = errors.New("invalid empty target type") // ErrNoLineRange is thrown when bandit produces a finding without a line range ErrNoLineRange = errors.Errorf("bandit result does not contain a line range") // ErrBadDataSource is thrown when bandit produces a finding that cannot have a datasource (e.g. no filename) ErrBadDataSource = errors.Errorf("failed to marshal data source to JSON") )
Functions ¶
This section is empty.
Types ¶
type BanditOut ¶
type BanditOut struct {
Errors []any `json:"errors,omitempty"`
GeneratedAt time.Time `json:"generated_at,omitempty"`
Metrics any `json:"metrics,omitempty"`
Results []*BanditResult `json:"results"`
}
BanditOut represents the output of a bandit run.
type BanditResult ¶
type BanditResult struct {
Code string `json:"code,omitempty"`
ColOffset int `json:"col_offset,omitempty"`
EndColOffset int `json:"end_col_offset,omitempty"`
Filename string `json:"filename,omitempty"`
IssueConfidence string `json:"issue_confidence,omitempty"`
IssueCwe BanditCWE `json:"issue_cwe,omitempty"`
IssueSeverity string `json:"issue_severity,omitempty"`
IssueText string `json:"issue_text,omitempty"`
LineNumber int `json:"line_number,omitempty"`
LineRange []int `json:"line_range,omitempty"`
MoreInfo string `json:"more_info,omitempty"`
TestID string `json:"test_id,omitempty"`
TestName string `json:"test_name,omitempty"`
}
BanditResult represents a Bandit Result.
type BanditTransformer ¶
type BanditTransformer struct {
// contains filtered or unexported fields
}
BanditTransformer represents the bandit output parser
func New ¶
func New(opts ...BanditTransformerOption) (*BanditTransformer, error)
New returns a new bandit transformer.
func (*BanditTransformer) Transform ¶
func (b *BanditTransformer) Transform(ctx context.Context) ([]*ocsf.VulnerabilityFinding, error)
Transform transforms raw sarif findings into ocsf vulnerability findings.
type BanditTransformerOption ¶
type BanditTransformerOption func(b *BanditTransformer) error
BanditTransformerOption allows customising the transformer.
func BanditRawOutFileContents ¶
func BanditRawOutFileContents(contents []byte) BanditTransformerOption
BanditRawOutFileContents allows customising the underlying raw out file contents.
func BanditRawOutFilePath ¶
func BanditRawOutFilePath(path string) BanditTransformerOption
BanditRawOutFilePath allows customising the underlying raw out file path.
func BanditTransformerWithClock ¶
func BanditTransformerWithClock(clock clockwork.Clock) BanditTransformerOption
BanditTransformerWithClock allows customising the underlying clock.
func BanditTransformerWithTarget ¶
func BanditTransformerWithTarget(target ocsffindinginfo.DataSource_TargetType) BanditTransformerOption
BanditTransformerWithTarget allows customising the underlying target type.
Click to show internal directories.
Click to hide internal directories.