27
27
from sortedcontainers import SortedSet
28
28
29
29
from ..exception .model import MutuallyExclusivePropertiesException , NoPropertiesProvidedException
30
- from . import ComparableTuple , OrganizationalContact , OrganizationalEntity , Tool , XsUri
30
+ from . import ComparableTuple , OrganizationalContact , OrganizationalEntity , Property , Tool , XsUri
31
31
from .bom_ref import BomRef
32
32
from .impact_analysis import (
33
33
ImpactAnalysisAffectedStatus ,
@@ -788,6 +788,7 @@ def __init__(self, *, bom_ref: Optional[str] = None, id: Optional[str] = None,
788
788
credits : Optional [VulnerabilityCredits ] = None ,
789
789
tools : Optional [Iterable [Tool ]] = None , analysis : Optional [VulnerabilityAnalysis ] = None ,
790
790
affects_targets : Optional [Iterable [BomTarget ]] = None ,
791
+ properties : Optional [Iterable [Property ]] = None ,
791
792
# Deprecated Parameters kept for backwards compatibility
792
793
source_name : Optional [str ] = None , source_url : Optional [str ] = None ,
793
794
recommendations : Optional [Iterable [str ]] = None ) -> None :
@@ -808,6 +809,7 @@ def __init__(self, *, bom_ref: Optional[str] = None, id: Optional[str] = None,
808
809
self .tools = tools or [] # type: ignore
809
810
self .analysis = analysis
810
811
self .affects = affects_targets or [] # type: ignore
812
+ self .properties = properties or [] # type: ignore
811
813
812
814
if source_name or source_url :
813
815
warnings .warn ('`source_name` and `source_url` are deprecated - use `source`' , DeprecationWarning )
@@ -1062,6 +1064,21 @@ def affects(self) -> "SortedSet[BomTarget]":
1062
1064
def affects (self , affects_targets : Iterable [BomTarget ]) -> None :
1063
1065
self ._affects = SortedSet (affects_targets )
1064
1066
1067
+ @property
1068
+ def properties (self ) -> "SortedSet[Property]" :
1069
+ """
1070
+ Provides the ability to document properties in a key/value store. This provides flexibility to include data not
1071
+ officially supported in the standard without having to use additional namespaces or create extensions.
1072
+
1073
+ Return:
1074
+ Set of `Property`
1075
+ """
1076
+ return self ._properties
1077
+
1078
+ @properties .setter
1079
+ def properties (self , properties : Iterable [Property ]) -> None :
1080
+ self ._properties = SortedSet (properties )
1081
+
1065
1082
def __eq__ (self , other : object ) -> bool :
1066
1083
if isinstance (other , Vulnerability ):
1067
1084
return hash (other ) == hash (self )
@@ -1079,7 +1096,7 @@ def __hash__(self) -> int:
1079
1096
return hash ((
1080
1097
self .id , self .source , tuple (self .references ), tuple (self .ratings ), tuple (self .cwes ), self .description ,
1081
1098
self .detail , self .recommendation , tuple (self .advisories ), self .created , self .published , self .updated ,
1082
- self .credits , tuple (self .tools ), self .analysis , tuple (self .affects )
1099
+ self .credits , tuple (self .tools ), self .analysis , tuple (self .affects ), tuple ( self . properties )
1083
1100
))
1084
1101
1085
1102
def __repr__ (self ) -> str :
0 commit comments