Skip to content

Commit

Permalink
feat: refactor cvss property name
Browse files Browse the repository at this point in the history
  • Loading branch information
chen-keinan committed Jun 23, 2021
1 parent 8503ad3 commit 4d4b7f4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ type CVEMeta struct {
CVSSMeta *CVSS `yaml:",omitempty"`
}
type CVSS struct {
Version string `yaml:",omitempty"`
BaseScore float32 `yaml:",omitempty"`
Vector string `yaml:",omitempty"`
Version string `yaml:",omitempty"`
Score float32 `yaml:",omitempty"`
Vector string `yaml:",omitempty"`
}

type Report struct {
Expand Down
4 changes: 2 additions & 2 deletions report/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ func CvssScoreToSeverity(cvss *CVSS) string {
}
switch cvss.Version {
case "v2":
return cvssV2SeverityByScore(cvss.BaseScore)
return cvssV2SeverityByScore(cvss.Score)
case "v3":
return cvssV3SeverityByScore(cvss.BaseScore)
return cvssV3SeverityByScore(cvss.Score)
default:
return ""
}
Expand Down
2 changes: 1 addition & 1 deletion report/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestReverseString1(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := CvssScoreToSeverity(&CVSS{Version: tt.version, BaseScore: tt.baseScore}); got != tt.want {
if got := CvssScoreToSeverity(&CVSS{Version: tt.version, Score: tt.baseScore}); got != tt.want {
t.Errorf("CvssScoreToSeverity() = %v, want %v", got, tt.want)
}
})
Expand Down

0 comments on commit 4d4b7f4

Please sign in to comment.