Documentation ¶
Index ¶
- Constants
- Variables
- func CompareSeverity(severity1, severity2 Severity) int
- func GetAsDetails(severity Severity, applicabilityStatus jasutils.ApplicabilityStatus, ...) formats.SeverityDetails
- func GetSeverityPriority(severity Severity, applicabilityStatus jasutils.ApplicabilityStatus) int
- func GetSeverityScore(severity Severity, applicabilityStatus jasutils.ApplicabilityStatus) float32
- func ParseToSeverityDetails(severity string, sarifSeverity, pretty bool, ...) (out formats.SeverityDetails, err error)
- type SarifSeverityLevel
- type Severity
- type SeverityDetails
Constants ¶
View Source
const ( MinCveScore = 0.0 MaxCveScore = 10.0 // When parsing Sarif level to severity, // If the level is not provided, the value is defaulted to be 'Medium' SeverityDefaultValue = Medium SarifSeverityRuleProperty = "security-severity" )
Variables ¶
View Source
var Severities = map[Severity]map[jasutils.ApplicabilityStatus]*SeverityDetails{ Critical: { jasutils.Applicable: &SeverityDetails{Priority: 20, Score: MaxCveScore, Emoji: "💀", style: color.New(color.BgLightRed, color.LightWhite)}, jasutils.ApplicabilityUndetermined: &SeverityDetails{Priority: 19, Score: MaxCveScore, Emoji: "💀", style: color.New(color.BgLightRed, color.LightWhite)}, jasutils.NotCovered: &SeverityDetails{Priority: 18, Score: MaxCveScore, Emoji: "💀", style: color.New(color.BgLightRed, color.LightWhite)}, jasutils.NotApplicable: &SeverityDetails{Priority: 5, Score: MaxCveScore, Emoji: "💀", style: color.New(color.Gray)}, }, High: { jasutils.Applicable: &SeverityDetails{Priority: 17, Score: 8.9, Emoji: "🔥", style: color.New(color.Red)}, jasutils.ApplicabilityUndetermined: &SeverityDetails{Priority: 16, Score: 8.9, Emoji: "🔥", style: color.New(color.Red)}, jasutils.NotCovered: &SeverityDetails{Priority: 15, Score: 8.9, Emoji: "🔥", style: color.New(color.Red)}, jasutils.NotApplicable: &SeverityDetails{Priority: 4, Score: 8.9, Emoji: "🔥", style: color.New(color.Gray)}, }, Medium: { jasutils.Applicable: &SeverityDetails{Priority: 14, Score: 6.9, Emoji: "🎃", style: color.New(color.Yellow)}, jasutils.ApplicabilityUndetermined: &SeverityDetails{Priority: 13, Score: 6.9, Emoji: "🎃", style: color.New(color.Yellow)}, jasutils.NotCovered: &SeverityDetails{Priority: 12, Score: 6.9, Emoji: "🎃", style: color.New(color.Yellow)}, jasutils.NotApplicable: &SeverityDetails{Priority: 3, Score: 6.9, Emoji: "🎃", style: color.New(color.Gray)}, }, Low: { jasutils.Applicable: &SeverityDetails{Priority: 11, Score: 3.9, Emoji: "👻"}, jasutils.ApplicabilityUndetermined: &SeverityDetails{Priority: 10, Score: 3.9, Emoji: "👻"}, jasutils.NotCovered: &SeverityDetails{Priority: 9, Score: 3.9, Emoji: "👻"}, jasutils.NotApplicable: &SeverityDetails{Priority: 2, Score: 3.9, Emoji: "👻", style: color.New(color.Gray)}, }, Unknown: { jasutils.Applicable: &SeverityDetails{Priority: 8, Score: MinCveScore, Emoji: "😐"}, jasutils.ApplicabilityUndetermined: &SeverityDetails{Priority: 7, Score: MinCveScore, Emoji: "😐"}, jasutils.NotCovered: &SeverityDetails{Priority: 6, Score: MinCveScore, Emoji: "😐"}, jasutils.NotApplicable: &SeverityDetails{Priority: 1, Score: MinCveScore, Emoji: "😐", style: color.New(color.Gray)}, }, }
Functions ¶
func CompareSeverity ¶
CompareSeverity compares two severities and returns the difference in priority If severity1 is more severe than severity2, the result will be positive
func GetAsDetails ¶
func GetAsDetails(severity Severity, applicabilityStatus jasutils.ApplicabilityStatus, pretty bool) formats.SeverityDetails
func GetSeverityPriority ¶
func GetSeverityPriority(severity Severity, applicabilityStatus jasutils.ApplicabilityStatus) int
func GetSeverityScore ¶
func GetSeverityScore(severity Severity, applicabilityStatus jasutils.ApplicabilityStatus) float32
func ParseToSeverityDetails ¶
func ParseToSeverityDetails(severity string, sarifSeverity, pretty bool, applicabilityStatus jasutils.ApplicabilityStatus) (out formats.SeverityDetails, err error)
Types ¶
type SarifSeverityLevel ¶
type SarifSeverityLevel string
const ( LevelError SarifSeverityLevel = "error" LevelWarning SarifSeverityLevel = "warning" LevelInfo SarifSeverityLevel = "info" LevelNote SarifSeverityLevel = "note" LevelNone SarifSeverityLevel = "none" )
func GetSarifSeverityLevel ¶
func GetSarifSeverityLevel(severity string) SarifSeverityLevel
func ParseToSarifSeverityLevel ¶
func ParseToSarifSeverityLevel(sarifSeverity string) (parsed SarifSeverityLevel, err error)
func SeverityToSarifSeverityLevel ¶
func SeverityToSarifSeverityLevel(severity Severity) SarifSeverityLevel
func (SarifSeverityLevel) String ¶
func (s SarifSeverityLevel) String() string
type SeverityDetails ¶
type SeverityDetails struct { Priority int // for GitHub Security Alerts Score float32 // Pretty format Emoji string // contains filtered or unexported fields }
func GetSeverityDetails ¶
func GetSeverityDetails(severity Severity, applicabilityStatus jasutils.ApplicabilityStatus) *SeverityDetails
func ParseForDetails ¶
func ParseForDetails(severity string, sarifSeverity bool, applicabilityStatus jasutils.ApplicabilityStatus) (details *SeverityDetails, err error)
func (SeverityDetails) ToDetails ¶
func (sd SeverityDetails) ToDetails(severity Severity, pretty bool) formats.SeverityDetails
Click to show internal directories.
Click to hide internal directories.