"""Component data classes used in AVID report and vulnerability datamodels."""fromtypingimportDict,List,OptionalfrompydanticimportBaseModelfrom.enumsimport*
[docs]classLangValue(BaseModel):"""Generic class to store a string with its language specified."""lang:strvalue:str
[docs]classArtifact(BaseModel):"""Type and name of an affected artifact."""type:ArtifactTypeEnumname:str
[docs]classDetection(BaseModel):"""Method to detect a specific issue."""type:MethodEnumname:str
[docs]classAffects(BaseModel):"""Information on Artifact(s) affected by this report."""developer:List[str]deployer:List[str]artifacts:List[Artifact]
[docs]classProblemtype(BaseModel):"""Description of the problem a report/vuln is concerned with."""classof:ClassEnumtype:Optional[TypeEnum]description:LangValue
[docs]classMetric(BaseModel):"""Quantification of the issue in a specific report."""name:strdetection_method:Detectionresults:Dict
[docs]classReference(BaseModel):"""Details for a reference of a report/vulnerability."""type:Optional[str]label:strurl:str# AnyUrl is a better fit, but keeping this because submissions are not standard yetclassConfig:# type is excluded if Nonefields={'type':{'exclude':True}}
[docs]classAvidTaxonomy(BaseModel):"""AVID taxonomy mappings of a report/vulnerability."""vuln_id:Optional[str]risk_domain:List[str]sep_view:List[SepEnum]lifecycle_view:List[LifecycleEnum]taxonomy_version:strclassConfig:# vuln_id is excluded if Nonefields={'vuln_id':{'exclude':True}}
[docs]classImpact(BaseModel):"""Impact information of a report/vulnerability, e.g. different taxonomy mappings, harm and severity scores."""avid:AvidTaxonomy