Skip to content

v1.6.2

Compare
Choose a tag to compare
@spiegel-im-spiegel spiegel-im-spiegel released this 02 Feb 10:09
· 14 commits to master since this release
v1.6.2
99e85cc

What's Changed

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