func ToCVSSv3()

in pkg/utils/grafeas.go [180:212]


func ToCVSSv3(baseScore float32, vector string) *g.CVSSv3 {
	c := g.CVSSv3{
		BaseScore: baseScore,
	}

	for _, v := range strings.Split(vector, "/") {
		tokens := strings.Split(v, ":")
		if len(tokens) != 2 {
			continue
		}

		switch tokens[0] {
		case "AV":
			c.AttackVector = toCVSSv3AttackVector(tokens[1])
		case "AC":
			c.AttackComplexity = toCVSSv3AttackComplexity(tokens[1])
		case "PR":
			c.PrivilegesRequired = toCVSSv3PrivilegesRequired(tokens[1])
		case "UI":
			c.UserInteraction = toCVSSv3UserInteraction(tokens[1])
		case "S":
			c.Scope = toCVSSv3Scope(tokens[1])
		case "C":
			c.ConfidentialityImpact = toCVSSv3Impact(tokens[1])
		case "I":
			c.IntegrityImpact = toCVSSv3Impact(tokens[1])
		case "A":
			c.AvailabilityImpact = toCVSSv3Impact(tokens[1])
		}
	}

	return &c
}