Skip to content

Commit

Permalink
Revert crypto PoC
Browse files Browse the repository at this point in the history
  • Loading branch information
8R0WNI3 committed Dec 12, 2024
1 parent 0c84de8 commit b22f7bb
Showing 1 changed file with 0 additions and 112 deletions.
112 changes: 0 additions & 112 deletions dso/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class Datasource:
CHECKMARX = 'checkmarx'
CLAMAV = 'clamav'
CC_UTILS = 'cc-utils'
CRYPTO = 'crypto'
DELIVERY_DASHBOARD = 'delivery-dashboard'
DIKI = 'diki'

Expand All @@ -63,11 +62,6 @@ def datasource_to_datatypes(datasource: str) -> tuple[str]:
Datasource.CC_UTILS: (
Datatype.OS_IDS,
),
Datasource.CRYPTO: (
Datatype.ARTEFACT_SCAN_INFO,
Datatype.CRYPTO_ASSET,
Datatype.FIPS_FINDING,
),
Datasource.DELIVERY_DASHBOARD: (
Datatype.RESCORING,
),
Expand Down Expand Up @@ -220,8 +214,6 @@ class Datatype:
RESCORING = 'rescorings'
COMPLIANCE_SNAPSHOTS = 'compliance/snapshots'
ARTEFACT_SCAN_INFO = 'meta/artefact_scan_info'
CRYPTO_ASSET = 'crypto_asset'
FIPS_FINDING = 'finding/fips'

@staticmethod
def datatype_to_datasource(datatype: str) -> str:
Expand All @@ -232,8 +224,6 @@ def datatype_to_datasource(datatype: str) -> str:
Datatype.CODECHECKS_AGGREGATED: Datasource.CHECKMARX,
Datatype.MALWARE_FINDING: Datasource.CLAMAV,
Datatype.DIKI_FINDING: Datasource.DIKI,
Datatype.CRYPTO_ASSET: Datasource.CRYPTO,
Datatype.FIPS_FINDING: Datasource.CRYPTO,
}[datatype]


Expand Down Expand Up @@ -399,103 +389,6 @@ def key(self) -> str:
return _as_key(self.provider_id, f'{self.ruleset_id}:{self.ruleset_version}', self.rule_id)


class AssetTypes(enum.StrEnum):
ALGORITHM = 'algorithm'
CERTIFICATE = 'certificate'
LIBRARY = 'library'
PROTOCOL = 'protocol'
RELATED_CRYPTO_MATERIAL = 'related-crypto-material'


@dataclasses.dataclass
class AlgorithmProperties:
name: str
primitive: str | None = None
parameter_set_identifier: str | None = None
curve: str | None = None
padding: str | None = None

@property
def key(self) -> str:
return _as_key(
self.name,
self.primitive,
self.parameter_set_identifier,
self.curve,
self.padding,
)


@dataclasses.dataclass
class CertificateProperties:
signature_algorithm_ref: str | None = None
subject_public_key_ref: str | None = None

@property
def key(self) -> str:
return _as_key(self.signature_algorithm_ref, self.subject_public_key_ref)


@dataclasses.dataclass
class LibraryProperties:
name: str
version: str | None = None

@property
def key(self) -> str:
return _as_key(self.name, self.version)


@dataclasses.dataclass
class ProtocolProperties:
type: str | None = None
version: str | None = None

@property
def key(self) -> str:
return _as_key(self.type, self.version)


@dataclasses.dataclass
class RelatedCryptoMaterialProperties:
type: str | None = None
algorithm_ref: str | None = None
size: int | None = None

@property
def key(self) -> str:
return _as_key(self.type, self.algorithm_ref, str(self.size))


@dataclasses.dataclass
class CryptoAsset:
names: list[str]
locations: list[str]
asset_type: AssetTypes
properties: (
AlgorithmProperties
| CertificateProperties
| LibraryProperties
| RelatedCryptoMaterialProperties
| ProtocolProperties
)
count: int = 1

@property
def key(self) -> str:
return _as_key(self.asset_type, self.properties.key)


@dataclasses.dataclass(frozen=True)
class FipsFinding(Finding):
asset: CryptoAsset
summary: str | None = None

@property
def key(self) -> str:
return self.asset.key


@dataclasses.dataclass(frozen=True)
class User:
username: str
Expand Down Expand Up @@ -532,7 +425,6 @@ class CustomRescoring:
RescoringVulnerabilityFinding
| RescoringLicenseFinding
| MalwareFindingDetails
| CryptoAsset
)
referenced_type: str
severity: str
Expand Down Expand Up @@ -631,8 +523,6 @@ class ArtefactMetadata:
| OsID
| CustomRescoring
| ComplianceSnapshot
| CryptoAsset
| FipsFinding
| dict # fallback, there should be a type
)
discovery_date: datetime.date | None = None # required for finding specific SLA tracking
Expand All @@ -651,9 +541,7 @@ def from_dict(raw: dict):
ArtefactKind,
ComplianceSnapshotStatuses,
MetaRescoringRules,
AssetTypes,
],
strict=True,
),
)

Expand Down

0 comments on commit b22f7bb

Please sign in to comment.