v1.6.2
spiegel-im-spiegel
released this
02 Feb 10:09
·
14 commits
to master
since this release
What's Changed
- Fix encode CVSSv2 vector string when skip Temporal or Environmental (issue #28) by @spiegel-im-spiegel in #30
package main
import (
"fmt"
"github.com/goark/go-cvss/v2/metric"
)
func main() {
testcase := []struct {
name string
vector string
}{
// CVE-2003-0062 (cf. https://www.first.org/cvss/v2/guide 3.3.3)
{name: "full metrics", vector: "AV:L/AC:H/Au:N/C:C/I:C/A:C/E:POC/RL:OF/RC:C/CDP:H/TD:H/CR:M/IR:M/AR:M"},
{name: "Base only", vector: "AV:L/AC:H/Au:N/C:C/I:C/A:C"},
{name: "skip Environmental", vector: "AV:L/AC:H/Au:N/C:C/I:C/A:C/E:POC/RL:OF/RC:C"},
{name: "skip Temporal", vector: "AV:L/AC:H/Au:N/C:C/I:C/A:C/CDP:H/TD:H/CR:M/IR:M/AR:M"},
}
for _, tc := range testcase {
fmt.Println(tc.name)
vec, err := metric.NewEnvironmental().Decode(tc.vector)
fmt.Printf("\t-> vector: %v\n", vec)
fmt.Printf("\t-> err: %v\n", err)
fmt.Printf("\t-> Severity: %v (%v)\n", vec.Severity(), vec.Score())
}
}
Output (https://go.dev/play/p/3ZiGMPBxNY0):
full metrics
-> vector: AV:L/AC:H/Au:N/C:C/I:C/A:C/E:POC/RL:OF/RC:C/CDP:H/TD:H/CR:M/IR:M/AR:M
-> err: <nil>
-> Severity: High (7.5)
Base only
-> vector: AV:L/AC:H/Au:N/C:C/I:C/A:C
-> err: <nil>
-> Severity: Medium (6.2)
skip Environmental
-> vector: AV:L/AC:H/Au:N/C:C/I:C/A:C/E:POC/RL:OF/RC:C
-> err: <nil>
-> Severity: Medium (4.9)
skip Temporal
-> vector: AV:L/AC:H/Au:N/C:C/I:C/A:C/CDP:H/TD:H/CR:M/IR:M/AR:M
-> err: <nil>
-> Severity: High (8.1)
Full Changelog: v1.6.1...v1.6.2