2727from sortedcontainers import SortedSet
2828
2929from ..exception .model import MutuallyExclusivePropertiesException , NoPropertiesProvidedException
30- from . import ComparableTuple , OrganizationalContact , OrganizationalEntity , Tool , XsUri
30+ from . import ComparableTuple , OrganizationalContact , OrganizationalEntity , Property , Tool , XsUri
3131from .bom_ref import BomRef
3232from .impact_analysis import (
3333 ImpactAnalysisAffectedStatus ,
@@ -788,6 +788,7 @@ def __init__(self, *, bom_ref: Optional[str] = None, id: Optional[str] = None,
788788 credits : Optional [VulnerabilityCredits ] = None ,
789789 tools : Optional [Iterable [Tool ]] = None , analysis : Optional [VulnerabilityAnalysis ] = None ,
790790 affects_targets : Optional [Iterable [BomTarget ]] = None ,
791+ properties : Optional [Iterable [Property ]] = None ,
791792 # Deprecated Parameters kept for backwards compatibility
792793 source_name : Optional [str ] = None , source_url : Optional [str ] = None ,
793794 recommendations : Optional [Iterable [str ]] = None ) -> None :
@@ -808,6 +809,7 @@ def __init__(self, *, bom_ref: Optional[str] = None, id: Optional[str] = None,
808809 self .tools = tools or [] # type: ignore
809810 self .analysis = analysis
810811 self .affects = affects_targets or [] # type: ignore
812+ self .properties = properties or [] # type: ignore
811813
812814 if source_name or source_url :
813815 warnings .warn ('`source_name` and `source_url` are deprecated - use `source`' , DeprecationWarning )
@@ -1062,6 +1064,21 @@ def affects(self) -> "SortedSet[BomTarget]":
10621064 def affects (self , affects_targets : Iterable [BomTarget ]) -> None :
10631065 self ._affects = SortedSet (affects_targets )
10641066
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+
10651082 def __eq__ (self , other : object ) -> bool :
10661083 if isinstance (other , Vulnerability ):
10671084 return hash (other ) == hash (self )
@@ -1079,7 +1096,7 @@ def __hash__(self) -> int:
10791096 return hash ((
10801097 self .id , self .source , tuple (self .references ), tuple (self .ratings ), tuple (self .cwes ), self .description ,
10811098 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 )
10831100 ))
10841101
10851102 def __repr__ (self ) -> str :
0 commit comments