Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions avidtools/datamodels/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,31 @@ class Config: # vuln_id is excluded if None
fields = {"vuln_id": {"exclude": True}}


class CVSSScores(BaseModel):
"""CVSS v3.0/v3.1 severity metrics."""

version: str
vectorString: str
Copy link

Copilot AI Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field name vectorString uses camelCase, which is inconsistent with Python naming conventions. All other fields in this codebase use snake_case (e.g., base_score, attack_vector). While this may match the CVSS JSON schema, for consistency with the rest of the AVID codebase, consider using vector_string and mapping it to the correct JSON field name using Pydantic's Field(alias="vectorString") if needed.

Copilot uses AI. Check for mistakes.
baseScore: float
Copy link

Copilot AI Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field name baseScore uses camelCase, which is inconsistent with Python naming conventions. All other fields in this codebase use snake_case. Consider using base_score and mapping it to the correct JSON field name using Pydantic's Field(alias="baseScore") if needed.

Copilot uses AI. Check for mistakes.
baseSeverity: str
Copy link

Copilot AI Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field name baseSeverity uses camelCase, which is inconsistent with Python naming conventions. All other fields in this codebase use snake_case. Consider using base_severity and mapping it to the correct JSON field name using Pydantic's Field(alias="baseSeverity") if needed.

Suggested change
baseSeverity: str
base_severity: str = Field(alias="baseSeverity")

Copilot uses AI. Check for mistakes.
attackVector: Optional[str] = None
Copy link

Copilot AI Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field name attackVector uses camelCase, which is inconsistent with Python naming conventions. All other fields in this codebase use snake_case. Consider using attack_vector and mapping it to the correct JSON field name using Pydantic's Field(alias="attackVector") if needed.

Copilot uses AI. Check for mistakes.
attackComplexity: Optional[str] = None
Copy link

Copilot AI Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field name attackComplexity uses camelCase, which is inconsistent with Python naming conventions. All other fields in this codebase use snake_case. Consider using attack_complexity and mapping it to the correct JSON field name using Pydantic's Field(alias="attackComplexity") if needed.

Copilot uses AI. Check for mistakes.
privilegesRequired: Optional[str] = None
Copy link

Copilot AI Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field name privilegesRequired uses camelCase, which is inconsistent with Python naming conventions. All other fields in this codebase use snake_case. Consider using privileges_required and mapping it to the correct JSON field name using Pydantic's Field(alias="privilegesRequired") if needed.

Copilot uses AI. Check for mistakes.
userInteraction: Optional[str] = None
Copy link

Copilot AI Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field name userInteraction uses camelCase, which is inconsistent with Python naming conventions. All other fields in this codebase use snake_case. Consider using user_interaction and mapping it to the correct JSON field name using Pydantic's Field(alias="userInteraction") if needed.

Copilot uses AI. Check for mistakes.
scope: Optional[str] = None
confidentialityImpact: Optional[str] = None
Copy link

Copilot AI Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field name confidentialityImpact uses camelCase, which is inconsistent with Python naming conventions. All other fields in this codebase use snake_case. Consider using confidentiality_impact and mapping it to the correct JSON field name using Pydantic's Field(alias="confidentialityImpact") if needed.

Copilot uses AI. Check for mistakes.
integrityImpact: Optional[str] = None
Copy link

Copilot AI Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field name integrityImpact uses camelCase, which is inconsistent with Python naming conventions. All other fields in this codebase use snake_case. Consider using integrity_impact and mapping it to the correct JSON field name using Pydantic's Field(alias="integrityImpact") if needed.

Copilot uses AI. Check for mistakes.
availabilityImpact: Optional[str] = None
Copy link

Copilot AI Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field name availabilityImpact uses camelCase, which is inconsistent with Python naming conventions. All other fields in this codebase use snake_case. Consider using availability_impact and mapping it to the correct JSON field name using Pydantic's Field(alias="availabilityImpact") if needed.

Copilot uses AI. Check for mistakes.


class CWETaxonomy(BaseModel):
"""CWE (Common Weakness Enumeration) taxonomy mapping."""

cweId: str
Copy link

Copilot AI Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field name cweId uses camelCase, which is inconsistent with Python naming conventions. All other fields in this codebase use snake_case. Consider using cwe_id and mapping it to the correct JSON field name using Pydantic's Field(alias="cweId") if needed.

Copilot uses AI. Check for mistakes.
description: Optional[str] = None
lang: Optional[str] = None


class Impact(BaseModel):
"""Impact information of a report/vulnerability.

Expand All @@ -109,6 +134,12 @@ class Impact(BaseModel):

avid: AvidTaxonomy
atlas: Optional[List[AtlasTaxonomy]] = None
cvss: Optional[CVSSScores] = None
cwe: Optional[List[CWETaxonomy]] = None

class Config: # atlas is excluded if None
fields = {"atlas": {"exclude": True}}
class Config: # Fields are excluded if None
fields = {
"atlas": {"exclude": True},
"cvss": {"exclude": True},
"cwe": {"exclude": True}
}
Loading