Skip to content

Commit

Permalink
Introduce sastfinding as a new finding type
Browse files Browse the repository at this point in the history
  • Loading branch information
TuanAnh17N committed Nov 28, 2024
1 parent fd2771a commit ba0a289
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions dso/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import dso.labels
import ocm
import unixutil.model
import rescore.model


@dataclasses.dataclass
Expand All @@ -24,6 +25,7 @@ class ScanArtifact:
class Datasource:
ARTEFACT_ENUMERATOR = 'artefact-enumerator'
BDBA = 'bdba'
CM06 = 'cm06'
CHECKMARX = 'checkmarx'
CLAMAV = 'clamav'
CC_UTILS = 'cc-utils'
Expand All @@ -43,6 +45,10 @@ def datasource_to_datatypes(datasource: str) -> tuple[str]:
Datatype.STRUCTURE_INFO,
Datatype.RESCORING,
),
Datasource.CM06: (
Datatype.ARTEFACT_SCAN_INFO,
Datatype.SAST_FINDING,
),
Datasource.CHECKMARX: (
Datatype.CODECHECKS_AGGREGATED,
),
Expand Down Expand Up @@ -193,6 +199,7 @@ class Datatype:
LICENSE = 'finding/license'
VULNERABILITY = 'finding/vulnerability'
MALWARE_FINDING = 'finding/malware'
SAST_FINDING = 'finding/sast'
DIKI_FINDING = 'finding/diki'
CODECHECKS_AGGREGATED = 'codechecks/aggregated'
OS_IDS = 'os_ids'
Expand All @@ -209,6 +216,7 @@ def datatype_to_datasource(datatype: str) -> str:
Datatype.CODECHECKS_AGGREGATED: Datasource.CHECKMARX,
Datatype.MALWARE_FINDING: Datasource.CLAMAV,
Datatype.DIKI_FINDING: Datasource.DIKI,
Datatype.SAST_FINDING: Datasource.CM06,
}[datatype]


Expand Down Expand Up @@ -355,6 +363,16 @@ def key(self) -> str:
return self.finding.key


@dataclasses.dataclass(frozen=True)
class SastFinding(Finding):
sast_status: rescore.model.SastStatus
component_context: rescore.model.ComponentContext

@property
def key(self) -> str:
return f'{self.component_context}|{self.sast_status}'


@dataclasses.dataclass(frozen=True)
class DikiCheck:
message: str
Expand Down Expand Up @@ -410,6 +428,7 @@ class CustomRescoring:
RescoringVulnerabilityFinding
| RescoringLicenseFinding
| MalwareFindingDetails
| SastFinding
)
referenced_type: str
severity: str
Expand Down Expand Up @@ -498,6 +517,7 @@ class ArtefactMetadata:
| LicenseFinding
| VulnerabilityFinding
| ClamAVMalwareFinding
| SastFinding
| DikiFinding
| CodecheckSummary
| OsID
Expand Down

0 comments on commit ba0a289

Please sign in to comment.