Documentation ¶
Index ¶
Constants ¶
const SnippetOffset = 1
SnippetOffset defines the number of lines captured before the beginning and after the end of a code snippet
Variables ¶
This section is empty.
Functions ¶
func CodeSnippet ¶
CodeSnippet extracts a code snippet based on the ast reference
func GetCweByRule ¶
GetCweByRule retrieves a cwe weakness for a given RuleID
Types ¶
type Issue ¶
type Issue struct { Severity Score `json:"severity"` // issue severity (how problematic it is) Confidence Score `json:"confidence"` // issue confidence (how sure we are we found it) Cwe *cwe.Weakness `json:"cwe"` // Cwe associated with RuleID RuleID string `json:"rule_id"` // Human readable explanation What string `json:"details"` // Human readable explanation File string `json:"file"` // File name we found it in Code string `json:"code"` // Impacted code line Line string `json:"line"` // Line number in file Col string `json:"column"` // Column number in line NoSec bool `json:"nosec"` // true if the issue is nosec Suppressions []SuppressionInfo `json:"suppressions"` // Suppression info of the issue }
Issue is returned by a gosec rule if it discovers an issue with the scanned code.
func (*Issue) FileLocation ¶
FileLocation point out the file path and line number in file
func (*Issue) WithSuppressions ¶
func (i *Issue) WithSuppressions(suppressions []SuppressionInfo) *Issue
WithSuppressions set the suppressions of the issue
type MetaData ¶
MetaData is embedded in all gosec rules. The Severity, Confidence and What message will be passed through to reported issues.
type Score ¶
type Score int
Score type used by severity and confidence values
func (Score) MarshalJSON ¶
MarshalJSON is used convert a Score object into a JSON representation
type SuppressionInfo ¶
type SuppressionInfo struct { Kind string `json:"kind"` Justification string `json:"justification"` }
SuppressionInfo object is to record the kind and the justification that used to suppress violations.