77
88 "github.com/CycloneDX/cyclonedx-go"
99 "github.com/gookit/color"
10- "github.com/jfrog/gofrog/datastructures"
1110 "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
1211 "github.com/jfrog/jfrog-cli-security/utils/formats"
1312 "github.com/jfrog/jfrog-cli-security/utils/jasutils"
@@ -113,43 +112,49 @@ func (sd SeverityDetails) ToDetails(severity Severity, pretty bool) formats.Seve
113112
114113var Severities = map [Severity ]map [jasutils.ApplicabilityStatus ]* SeverityDetails {
115114 Critical : {
116- jasutils .Applicable : & SeverityDetails {Priority : 30 , Score : MaxCveScore , Emoji : "💀" , style : color .New (color .BgLightRed , color .LightWhite )},
117- jasutils .ApplicabilityUndetermined : & SeverityDetails {Priority : 29 , Score : MaxCveScore , Emoji : "💀" , style : color .New (color .BgLightRed , color .LightWhite )},
118- jasutils .MissingContext : & SeverityDetails {Priority : 28 , Score : MaxCveScore , Emoji : "💀" , style : color .New (color .BgLightRed , color .LightWhite )},
119- jasutils .NotCovered : & SeverityDetails {Priority : 27 , Score : MaxCveScore , Emoji : "💀" , style : color .New (color .BgLightRed , color .LightWhite )},
115+ jasutils .Applicable : & SeverityDetails {Priority : 36 , Score : MaxCveScore , Emoji : "💀" , style : color .New (color .BgLightRed , color .LightWhite )},
116+ jasutils .ApplicabilityUndetermined : & SeverityDetails {Priority : 35 , Score : MaxCveScore , Emoji : "💀" , style : color .New (color .BgLightRed , color .LightWhite )},
117+ jasutils .NotScanned : & SeverityDetails {Priority : 34 , Score : MaxCveScore , Emoji : "💀" , style : color .New (color .BgLightRed , color .LightWhite )},
118+ jasutils .MissingContext : & SeverityDetails {Priority : 33 , Score : MaxCveScore , Emoji : "💀" , style : color .New (color .BgLightRed , color .LightWhite )},
119+ jasutils .NotCovered : & SeverityDetails {Priority : 32 , Score : MaxCveScore , Emoji : "💀" , style : color .New (color .BgLightRed , color .LightWhite )},
120120 jasutils .NotApplicable : & SeverityDetails {Priority : 6 , Score : MaxCveScore , Emoji : "💀" , style : color .New (color .Gray )},
121121 },
122122 High : {
123- jasutils .Applicable : & SeverityDetails {Priority : 26 , Score : 8.9 , Emoji : "🔥" , style : color .New (color .Red )},
124- jasutils .ApplicabilityUndetermined : & SeverityDetails {Priority : 25 , Score : 8.9 , Emoji : "🔥" , style : color .New (color .Red )},
125- jasutils .MissingContext : & SeverityDetails {Priority : 24 , Score : 8.9 , Emoji : "🔥" , style : color .New (color .Red )},
126- jasutils .NotCovered : & SeverityDetails {Priority : 23 , Score : 8.9 , Emoji : "🔥" , style : color .New (color .Red )},
123+ jasutils .Applicable : & SeverityDetails {Priority : 31 , Score : 8.9 , Emoji : "🔥" , style : color .New (color .Red )},
124+ jasutils .ApplicabilityUndetermined : & SeverityDetails {Priority : 30 , Score : 8.9 , Emoji : "🔥" , style : color .New (color .Red )},
125+ jasutils .NotScanned : & SeverityDetails {Priority : 29 , Score : 8.9 , Emoji : "🔥" , style : color .New (color .Red )},
126+ jasutils .MissingContext : & SeverityDetails {Priority : 28 , Score : 8.9 , Emoji : "🔥" , style : color .New (color .Red )},
127+ jasutils .NotCovered : & SeverityDetails {Priority : 27 , Score : 8.9 , Emoji : "🔥" , style : color .New (color .Red )},
127128 jasutils .NotApplicable : & SeverityDetails {Priority : 5 , Score : 8.9 , Emoji : "🔥" , style : color .New (color .Gray )},
128129 },
129130 Medium : {
130- jasutils .Applicable : & SeverityDetails {Priority : 22 , Score : 6.9 , Emoji : "🎃" , style : color .New (color .Yellow )},
131- jasutils .ApplicabilityUndetermined : & SeverityDetails {Priority : 21 , Score : 6.9 , Emoji : "🎃" , style : color .New (color .Yellow )},
132- jasutils .MissingContext : & SeverityDetails {Priority : 20 , Score : 6.9 , Emoji : "🎃" , style : color .New (color .Yellow )},
133- jasutils .NotCovered : & SeverityDetails {Priority : 19 , Score : 6.9 , Emoji : "🎃" , style : color .New (color .Yellow )},
131+ jasutils .Applicable : & SeverityDetails {Priority : 26 , Score : 6.9 , Emoji : "🎃" , style : color .New (color .Yellow )},
132+ jasutils .ApplicabilityUndetermined : & SeverityDetails {Priority : 25 , Score : 6.9 , Emoji : "🎃" , style : color .New (color .Yellow )},
133+ jasutils .NotScanned : & SeverityDetails {Priority : 24 , Score : 6.9 , Emoji : "🎃" , style : color .New (color .Yellow )},
134+ jasutils .MissingContext : & SeverityDetails {Priority : 23 , Score : 6.9 , Emoji : "🎃" , style : color .New (color .Yellow )},
135+ jasutils .NotCovered : & SeverityDetails {Priority : 22 , Score : 6.9 , Emoji : "🎃" , style : color .New (color .Yellow )},
134136 jasutils .NotApplicable : & SeverityDetails {Priority : 4 , Score : 6.9 , Emoji : "🎃" , style : color .New (color .Gray )},
135137 },
136138 Low : {
137- jasutils .Applicable : & SeverityDetails {Priority : 18 , Score : 3.9 , Emoji : "👻" },
138- jasutils .ApplicabilityUndetermined : & SeverityDetails {Priority : 17 , Score : 3.9 , Emoji : "👻" },
139- jasutils .MissingContext : & SeverityDetails {Priority : 16 , Score : 3.9 , Emoji : "👻" },
140- jasutils .NotCovered : & SeverityDetails {Priority : 15 , Score : 3.9 , Emoji : "👻" },
139+ jasutils .Applicable : & SeverityDetails {Priority : 21 , Score : 3.9 , Emoji : "👻" },
140+ jasutils .ApplicabilityUndetermined : & SeverityDetails {Priority : 20 , Score : 3.9 , Emoji : "👻" },
141+ jasutils .NotScanned : & SeverityDetails {Priority : 19 , Score : 3.9 , Emoji : "👻" },
142+ jasutils .MissingContext : & SeverityDetails {Priority : 18 , Score : 3.9 , Emoji : "👻" },
143+ jasutils .NotCovered : & SeverityDetails {Priority : 17 , Score : 3.9 , Emoji : "👻" },
141144 jasutils .NotApplicable : & SeverityDetails {Priority : 3 , Score : 3.9 , Emoji : "👻" , style : color .New (color .Gray )},
142145 },
143146 Information : {
144- jasutils .Applicable : & SeverityDetails {Priority : 14 , Score : MinCveScore , Emoji : "ℹ️" , style : color .New (color .Blue )},
145- jasutils .ApplicabilityUndetermined : & SeverityDetails {Priority : 13 , Score : MinCveScore , Emoji : "ℹ️" , style : color .New (color .Blue )},
146- jasutils .MissingContext : & SeverityDetails {Priority : 12 , Score : MinCveScore , Emoji : "ℹ️" , style : color .New (color .Blue )},
147- jasutils .NotCovered : & SeverityDetails {Priority : 11 , Score : MinCveScore , Emoji : "ℹ️" , style : color .New (color .Blue )},
147+ jasutils .Applicable : & SeverityDetails {Priority : 16 , Score : MinCveScore , Emoji : "ℹ️" , style : color .New (color .Blue )},
148+ jasutils .ApplicabilityUndetermined : & SeverityDetails {Priority : 15 , Score : MinCveScore , Emoji : "ℹ️" , style : color .New (color .Blue )},
149+ jasutils .NotScanned : & SeverityDetails {Priority : 14 , Score : MinCveScore , Emoji : "ℹ️" , style : color .New (color .Blue )},
150+ jasutils .MissingContext : & SeverityDetails {Priority : 13 , Score : MinCveScore , Emoji : "ℹ️" , style : color .New (color .Blue )},
151+ jasutils .NotCovered : & SeverityDetails {Priority : 12 , Score : MinCveScore , Emoji : "ℹ️" , style : color .New (color .Blue )},
148152 jasutils .NotApplicable : & SeverityDetails {Priority : 2 , Score : MinCveScore , Emoji : "ℹ️" , style : color .New (color .Gray )},
149153 },
150154 Unknown : {
151- jasutils .Applicable : & SeverityDetails {Priority : 10 , Score : MinCveScore , Emoji : "😐" },
152- jasutils .ApplicabilityUndetermined : & SeverityDetails {Priority : 9 , Score : MinCveScore , Emoji : "😐" },
155+ jasutils .Applicable : & SeverityDetails {Priority : 11 , Score : MinCveScore , Emoji : "😐" },
156+ jasutils .ApplicabilityUndetermined : & SeverityDetails {Priority : 10 , Score : MinCveScore , Emoji : "😐" },
157+ jasutils .NotScanned : & SeverityDetails {Priority : 9 , Score : MinCveScore , Emoji : "😐" },
153158 jasutils .MissingContext : & SeverityDetails {Priority : 8 , Score : MinCveScore , Emoji : "😐" },
154159 jasutils .NotCovered : & SeverityDetails {Priority : 7 , Score : MinCveScore , Emoji : "😐" },
155160 jasutils .NotApplicable : & SeverityDetails {Priority : 1 , Score : MinCveScore , Emoji : "😐" , style : color .New (color .Gray )},
@@ -163,14 +168,6 @@ func supportedSeverities() (severities []string) {
163168 return
164169}
165170
166- func supportedApplicabilityStatuses () []string {
167- set := datastructures .MakeSet [string ]()
168- for status := range Severities [Critical ] {
169- set .Add (status .String ())
170- }
171- return set .ToSlice ()
172- }
173-
174171// -- Parsing functions, only for supported values --
175172
176173func ParseToSeverity (severity string ) (parsed Severity , err error ) {
@@ -230,10 +227,6 @@ func ParseSeverity(severity string, sarifSeverity bool) (parsed Severity, err er
230227}
231228
232229func ParseForDetails (severity string , sarifSeverity bool , applicabilityStatus jasutils.ApplicabilityStatus ) (details * SeverityDetails , err error ) {
233- if applicabilityStatus == jasutils .NotScanned {
234- err = errorutils .CheckErrorf ("only the following severities are supported: %s" , coreutils .ListToText (supportedApplicabilityStatuses ()))
235- return
236- }
237230 parsed , err := ParseSeverity (severity , sarifSeverity )
238231 if err != nil {
239232 return
@@ -253,9 +246,6 @@ func GetAsDetails(severity Severity, applicabilityStatus jasutils.ApplicabilityS
253246}
254247
255248func GetSeverityDetails (severity Severity , applicabilityStatus jasutils.ApplicabilityStatus ) * SeverityDetails {
256- if applicabilityStatus == jasutils .NotScanned {
257- applicabilityStatus = jasutils .Applicable
258- }
259249 details , err := ParseForDetails (severity .String (), false , applicabilityStatus )
260250 if err != nil {
261251 return & SeverityDetails {Priority : 0 , Score : 0 }
0 commit comments