MCPcopy Create free account
hub / github.com/aboutcode-org/vulnerablecode / ssvc_calculator

Function ssvc_calculator

vulnerabilities/utils.py:752–863  ·  view source on GitHub ↗

Return the ssvc vector and the decision value

(ssvc_data)

Source from the content-addressed store, hash-verified

750
751
752def ssvc_calculator(ssvc_data):
753 """
754 Return the ssvc vector and the decision value
755 """
756 options = ssvc_data.get("options", [])
757 timestamp = ssvc_data.get("timestamp")
758
759 # Extract the options into a dictionary
760 options_dict = {k: v.lower() for option in options for k, v in option.items()}
761
762 # We copied the table value from this link.
763 # https://www.cisa.gov/sites/default/files/publications/cisa-ssvc-guide%20508c.pdf
764
765 # Determining Mission and Well-Being Impact Value
766 mission_well_being_table = {
767 # (Mission Prevalence, Public Well-being Impact) : "Mission & Well-being"
768 ("minimal", "minimal"): "low",
769 ("minimal", "material"): "medium",
770 ("minimal", "irreversible"): "high",
771 ("support", "minimal"): "medium",
772 ("support", "material"): "medium",
773 ("support", "irreversible"): "high",
774 ("essential", "minimal"): "high",
775 ("essential", "material"): "high",
776 ("essential", "irreversible"): "high",
777 }
778
779 if "Mission Prevalence" not in options_dict:
780 options_dict["Mission Prevalence"] = "minimal"
781
782 if "Public Well-being Impact" not in options_dict:
783 options_dict["Public Well-being Impact"] = "material"
784
785 options_dict["Mission & Well-being"] = mission_well_being_table[
786 (options_dict["Mission Prevalence"], options_dict["Public Well-being Impact"])
787 ]
788
789 decision_key = (
790 options_dict.get("Exploitation"),
791 options_dict.get("Automatable"),
792 options_dict.get("Technical Impact"),
793 options_dict.get("Mission & Well-being"),
794 )
795
796 decision_points = {
797 "Exploitation": {"E": {"none": "N", "poc": "P", "active": "A"}},
798 "Automatable": {"A": {"no": "N", "yes": "Y"}},
799 "Technical Impact": {"T": {"partial": "P", "total": "T"}},
800 "Public Well-being Impact": {"B": {"minimal": "M", "material": "A", "irreversible": "I"}},
801 "Mission Prevalence": {"P": {"minimal": "M", "support": "S", "essential": "E"}},
802 "Mission & Well-being": {"M": {"low": "L", "medium": "M", "high": "H"}},
803 }
804
805 # Create the SSVC vector
806 ssvc_vector = "SSVCv2/"
807 for key, value_map in options_dict.items():
808 options_key = decision_points.get(key)
809 for lhs, rhs_map in options_key.items():

Callers 1

parse_cve_advisoryMethod · 0.90

Calls 2

getMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected