CheckmarxPythonSDK 1.9.3__py3-none-any.whl → 1.9.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- CheckmarxPythonSDK/CxOne/__init__.py +42 -0
- CheckmarxPythonSDK/CxOne/apisecAPI.py +184 -7
- CheckmarxPythonSDK/CxOne/dto/BreakBuildExemptStateDto.py +28 -0
- CheckmarxPythonSDK/CxOne/dto/EnhancedIncidentsPaginationDTO.py +27 -0
- CheckmarxPythonSDK/CxOne/dto/EnhancedIncidentsWebDTO.py +52 -0
- CheckmarxPythonSDK/CxOne/dto/EvaluatedPolicyWebDto.py +34 -0
- CheckmarxPythonSDK/CxOne/dto/ExportParametersSbom.py +10 -0
- CheckmarxPythonSDK/CxOne/dto/ExportParametersScanReport.py +15 -0
- CheckmarxPythonSDK/CxOne/dto/FindingsWebDto.py +46 -0
- CheckmarxPythonSDK/CxOne/dto/IncidentResultWebDTO.py +64 -0
- CheckmarxPythonSDK/CxOne/dto/IncidentResultsDTO.py +36 -0
- CheckmarxPythonSDK/CxOne/dto/IncidentWebDto.py +47 -0
- CheckmarxPythonSDK/CxOne/dto/IncidentsPaginationDto.py +26 -0
- CheckmarxPythonSDK/CxOne/dto/PackageWebDto.py +45 -0
- CheckmarxPythonSDK/CxOne/dto/PoliciesPaginationDto.py +26 -0
- CheckmarxPythonSDK/CxOne/dto/PoliciesResultWebDto.py +31 -0
- CheckmarxPythonSDK/CxOne/dto/PolicyShortWebDto.py +21 -0
- CheckmarxPythonSDK/CxOne/dto/PolicyViolationWebDto.py +36 -0
- CheckmarxPythonSDK/CxOne/dto/PolicyWebDto.py +104 -0
- CheckmarxPythonSDK/CxOne/dto/ProjectWebDto.py +25 -0
- CheckmarxPythonSDK/CxOne/dto/ProjectsInPolicyDto.py +38 -0
- CheckmarxPythonSDK/CxOne/dto/RuleViolatedWebDto.py +35 -0
- CheckmarxPythonSDK/CxOne/dto/ScaExportFileFormats.py +18 -0
- CheckmarxPythonSDK/CxOne/dto/ScaExportStatus.py +23 -0
- CheckmarxPythonSDK/CxOne/dto/ViolatedPolicyWebDto.py +36 -0
- CheckmarxPythonSDK/CxOne/dto/ViolatingAssocProjectsWebDto.py +22 -0
- CheckmarxPythonSDK/CxOne/dto/ViolationDetailsDTO.py +31 -0
- CheckmarxPythonSDK/CxOne/dto/VulnerabilityWebDto.py +31 -0
- CheckmarxPythonSDK/CxOne/dto/__init__.py +26 -0
- CheckmarxPythonSDK/CxOne/policyManagerAPI.py +765 -0
- CheckmarxPythonSDK/CxOne/projectsAPI.py +14 -15
- CheckmarxPythonSDK/CxOne/repoManagerAPI.py +12 -2
- CheckmarxPythonSDK/CxOne/reportAPI.py +286 -45
- CheckmarxPythonSDK/CxReporting/api.py +82 -10
- CheckmarxPythonSDK/CxRestAPISDK/ScansAPI.py +40 -2
- CheckmarxPythonSDK/CxScaApiSDK/api.py +52 -29
- CheckmarxPythonSDK/__version__.py +1 -1
- CheckmarxPythonSDK/api_client.py +140 -5
- {checkmarxpythonsdk-1.9.3.dist-info → checkmarxpythonsdk-1.9.4.dist-info}/METADATA +1 -1
- {checkmarxpythonsdk-1.9.3.dist-info → checkmarxpythonsdk-1.9.4.dist-info}/RECORD +43 -16
- {checkmarxpythonsdk-1.9.3.dist-info → checkmarxpythonsdk-1.9.4.dist-info}/WHEEL +0 -0
- {checkmarxpythonsdk-1.9.3.dist-info → checkmarxpythonsdk-1.9.4.dist-info}/licenses/LICENSE +0 -0
- {checkmarxpythonsdk-1.9.3.dist-info → checkmarxpythonsdk-1.9.4.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@dataclass
|
|
6
|
+
class IncidentWebDto:
|
|
7
|
+
"""A policy incident (a policy violation recorded for a scan).
|
|
8
|
+
|
|
9
|
+
Attributes:
|
|
10
|
+
id (Optional[int]): Incident ID.
|
|
11
|
+
policyName (Optional[str]): Name of the violated policy.
|
|
12
|
+
projectName (Optional[str]): Name of the project scanned.
|
|
13
|
+
branch (Optional[str]): Branch scanned.
|
|
14
|
+
ruleName (Optional[str]): Name of the violated rule.
|
|
15
|
+
scanId (Optional[str]): The scan's UUID.
|
|
16
|
+
scanDate (Optional[str]): When the scan ran (date-time).
|
|
17
|
+
policyTags (List[str]): Tags on the violated policy.
|
|
18
|
+
defaultPolicy (Optional[bool]): Whether the policy is the tenant default.
|
|
19
|
+
defaultPolicyEvaluation (Optional[bool]): Whether the default policy
|
|
20
|
+
was the one evaluated.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
id: Optional[int] = None
|
|
24
|
+
policyName: Optional[str] = None
|
|
25
|
+
projectName: Optional[str] = None
|
|
26
|
+
branch: Optional[str] = None
|
|
27
|
+
ruleName: Optional[str] = None
|
|
28
|
+
scanId: Optional[str] = None
|
|
29
|
+
scanDate: Optional[str] = None
|
|
30
|
+
policyTags: List[str] = field(default_factory=list)
|
|
31
|
+
defaultPolicy: Optional[bool] = None
|
|
32
|
+
defaultPolicyEvaluation: Optional[bool] = None
|
|
33
|
+
|
|
34
|
+
@classmethod
|
|
35
|
+
def from_dict(cls, item: dict) -> "IncidentWebDto":
|
|
36
|
+
return cls(
|
|
37
|
+
id=item.get("id"),
|
|
38
|
+
policyName=item.get("policyName"),
|
|
39
|
+
projectName=item.get("projectName"),
|
|
40
|
+
branch=item.get("branch"),
|
|
41
|
+
ruleName=item.get("ruleName"),
|
|
42
|
+
scanId=item.get("scanId"),
|
|
43
|
+
scanDate=item.get("scanDate"),
|
|
44
|
+
policyTags=list(item.get("policyTags") or []),
|
|
45
|
+
defaultPolicy=item.get("defaultPolicy"),
|
|
46
|
+
defaultPolicyEvaluation=item.get("defaultPolicyEvaluation"),
|
|
47
|
+
)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
|
|
4
|
+
from .IncidentWebDto import IncidentWebDto
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class IncidentsPaginationDto:
|
|
9
|
+
"""Paginated response from the GET /incidents* endpoints (non-enhanced).
|
|
10
|
+
|
|
11
|
+
Attributes:
|
|
12
|
+
incidents (List[IncidentWebDto]): Incidents on the current page.
|
|
13
|
+
filteredIncidentsCount (Optional[int]): Total count after filtering.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
incidents: List[IncidentWebDto] = field(default_factory=list)
|
|
17
|
+
filteredIncidentsCount: Optional[int] = None
|
|
18
|
+
|
|
19
|
+
@classmethod
|
|
20
|
+
def from_dict(cls, item: dict) -> "IncidentsPaginationDto":
|
|
21
|
+
return cls(
|
|
22
|
+
incidents=[
|
|
23
|
+
IncidentWebDto.from_dict(i) for i in (item.get("incidents") or [])
|
|
24
|
+
],
|
|
25
|
+
filteredIncidentsCount=item.get("filteredIncidentsCount"),
|
|
26
|
+
)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
|
|
4
|
+
from .VulnerabilityWebDto import VulnerabilityWebDto
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class PackageWebDto:
|
|
9
|
+
"""An SCA package as referenced from a policy violation.
|
|
10
|
+
|
|
11
|
+
Attributes:
|
|
12
|
+
id (Optional[str]): Package ID.
|
|
13
|
+
name (Optional[str]): Package name.
|
|
14
|
+
version (Optional[str]): Package version.
|
|
15
|
+
outdated (Optional[bool]): Whether a newer version is available.
|
|
16
|
+
highVulnerabilityCount (Optional[int]): Count of high-severity vulnerabilities.
|
|
17
|
+
mediumVulnerabilityCount (Optional[int]): Count of medium-severity vulnerabilities.
|
|
18
|
+
packageState (Optional[str]): Current state of the package.
|
|
19
|
+
vulnerabilities (List[VulnerabilityWebDto]): Vulnerabilities found in the package.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
id: Optional[str] = None
|
|
23
|
+
name: Optional[str] = None
|
|
24
|
+
version: Optional[str] = None
|
|
25
|
+
outdated: Optional[bool] = None
|
|
26
|
+
highVulnerabilityCount: Optional[int] = None
|
|
27
|
+
mediumVulnerabilityCount: Optional[int] = None
|
|
28
|
+
packageState: Optional[str] = None
|
|
29
|
+
vulnerabilities: List[VulnerabilityWebDto] = field(default_factory=list)
|
|
30
|
+
|
|
31
|
+
@classmethod
|
|
32
|
+
def from_dict(cls, item: dict) -> "PackageWebDto":
|
|
33
|
+
return cls(
|
|
34
|
+
id=item.get("id"),
|
|
35
|
+
name=item.get("name"),
|
|
36
|
+
version=item.get("version"),
|
|
37
|
+
outdated=item.get("outdated"),
|
|
38
|
+
highVulnerabilityCount=item.get("highVulnerabilityCount"),
|
|
39
|
+
mediumVulnerabilityCount=item.get("mediumVulnerabilityCount"),
|
|
40
|
+
packageState=item.get("packageState"),
|
|
41
|
+
vulnerabilities=[
|
|
42
|
+
VulnerabilityWebDto.from_dict(v)
|
|
43
|
+
for v in (item.get("vulnerabilities") or [])
|
|
44
|
+
],
|
|
45
|
+
)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
|
|
4
|
+
from .PolicyWebDto import PolicyWebDto
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class PoliciesPaginationDto:
|
|
9
|
+
"""Paginated response from GET /policies/v2 and GET /policies/v3.
|
|
10
|
+
|
|
11
|
+
Attributes:
|
|
12
|
+
policies (List[PolicyWebDto]): Policies on the current page.
|
|
13
|
+
filteredPoliciesCount (Optional[int]): Total count after filtering.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
policies: List[PolicyWebDto] = field(default_factory=list)
|
|
17
|
+
filteredPoliciesCount: Optional[int] = None
|
|
18
|
+
|
|
19
|
+
@classmethod
|
|
20
|
+
def from_dict(cls, item: dict) -> "PoliciesPaginationDto":
|
|
21
|
+
return cls(
|
|
22
|
+
policies=[
|
|
23
|
+
PolicyWebDto.from_dict(p) for p in (item.get("policies") or [])
|
|
24
|
+
],
|
|
25
|
+
filteredPoliciesCount=item.get("filteredPoliciesCount"),
|
|
26
|
+
)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
|
|
4
|
+
from .EvaluatedPolicyWebDto import EvaluatedPolicyWebDto
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class PoliciesResultWebDto:
|
|
9
|
+
"""Response from GET /evaluation (policy evaluation for a scan/project).
|
|
10
|
+
|
|
11
|
+
Attributes:
|
|
12
|
+
status (Optional[str]): Overall evaluation status. Values:
|
|
13
|
+
COMPLETED, NONE, EVALUATING.
|
|
14
|
+
breakBuild (Optional[bool]): Whether any evaluated policy breaks the build.
|
|
15
|
+
policies (List[EvaluatedPolicyWebDto]): Per-policy evaluation results.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
status: Optional[str] = None
|
|
19
|
+
breakBuild: Optional[bool] = None
|
|
20
|
+
policies: List[EvaluatedPolicyWebDto] = field(default_factory=list)
|
|
21
|
+
|
|
22
|
+
@classmethod
|
|
23
|
+
def from_dict(cls, item: dict) -> "PoliciesResultWebDto":
|
|
24
|
+
return cls(
|
|
25
|
+
status=item.get("status"),
|
|
26
|
+
breakBuild=item.get("breakBuild"),
|
|
27
|
+
policies=[
|
|
28
|
+
EvaluatedPolicyWebDto.from_dict(p)
|
|
29
|
+
for p in (item.get("policies") or [])
|
|
30
|
+
],
|
|
31
|
+
)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@dataclass
|
|
6
|
+
class PolicyShortWebDto:
|
|
7
|
+
"""A policy's ID and name only.
|
|
8
|
+
|
|
9
|
+
Returned by POST /policies/v2 (create) and GET /policies/default.
|
|
10
|
+
|
|
11
|
+
Attributes:
|
|
12
|
+
id (Optional[int]): Policy ID.
|
|
13
|
+
name (Optional[str]): Policy name.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
id: Optional[int] = None
|
|
17
|
+
name: Optional[str] = None
|
|
18
|
+
|
|
19
|
+
@classmethod
|
|
20
|
+
def from_dict(cls, item: dict) -> "PolicyShortWebDto":
|
|
21
|
+
return cls(id=item.get("id"), name=item.get("name"))
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
|
|
4
|
+
from .ViolatedPolicyWebDto import ViolatedPolicyWebDto
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class PolicyViolationWebDto:
|
|
9
|
+
"""Response from GET /api/policy_management_service_uri/policy_violations.
|
|
10
|
+
|
|
11
|
+
Attributes:
|
|
12
|
+
scanId (Optional[str]): The scan's UUID.
|
|
13
|
+
projectId (Optional[str]): The project ID.
|
|
14
|
+
generatedOn (Optional[str]): When the evaluation was generated (date-time).
|
|
15
|
+
policies (List[ViolatedPolicyWebDto]): Policies violated by the scan.
|
|
16
|
+
status (Optional[str]): Evaluation status. Values: COMPLETED, EVALUATING, NONE.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
scanId: Optional[str] = None
|
|
20
|
+
projectId: Optional[str] = None
|
|
21
|
+
generatedOn: Optional[str] = None
|
|
22
|
+
policies: List[ViolatedPolicyWebDto] = field(default_factory=list)
|
|
23
|
+
status: Optional[str] = None
|
|
24
|
+
|
|
25
|
+
@classmethod
|
|
26
|
+
def from_dict(cls, item: dict) -> "PolicyViolationWebDto":
|
|
27
|
+
return cls(
|
|
28
|
+
scanId=item.get("scanId"),
|
|
29
|
+
projectId=item.get("projectId"),
|
|
30
|
+
generatedOn=item.get("generatedOn"),
|
|
31
|
+
policies=[
|
|
32
|
+
ViolatedPolicyWebDto.from_dict(p)
|
|
33
|
+
for p in (item.get("policies") or [])
|
|
34
|
+
],
|
|
35
|
+
status=item.get("status"),
|
|
36
|
+
)
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
from dataclasses import dataclass, field, asdict
|
|
2
|
+
from typing import Dict, List, Optional
|
|
3
|
+
|
|
4
|
+
from .BreakBuildExemptStateDto import BreakBuildExemptStateDto
|
|
5
|
+
from .ProjectWebDto import ProjectWebDto
|
|
6
|
+
from .ViolatingAssocProjectsWebDto import ViolatingAssocProjectsWebDto
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class PolicyWebDto:
|
|
11
|
+
"""A Policy Manager policy.
|
|
12
|
+
|
|
13
|
+
Used both as the request body for create/update and as the response
|
|
14
|
+
shape for get/list.
|
|
15
|
+
|
|
16
|
+
Attributes:
|
|
17
|
+
id (Optional[int]): Policy ID. Only set on existing policies.
|
|
18
|
+
name (str): Policy name (1-255 chars). Required.
|
|
19
|
+
description (Optional[str]): Policy description (0-2500 chars).
|
|
20
|
+
isActivated (Optional[bool]): Whether the policy is active.
|
|
21
|
+
tags (List[str]): Up to 50 unique tags.
|
|
22
|
+
breakBuild (Optional[bool]): Whether a violation breaks the build.
|
|
23
|
+
pinPolicy (Optional[bool]): Whether the policy is pinned.
|
|
24
|
+
lastViolated (Optional[str]): When the policy was last violated (date-time).
|
|
25
|
+
updatedAt (Optional[str]): Last update time (date-time).
|
|
26
|
+
projects (List[ProjectWebDto]): Projects the policy is assigned to.
|
|
27
|
+
netNewBreakBuild (Optional[bool]): Whether only net-new violations break the build.
|
|
28
|
+
type (Optional[str]): Policy type. Values: NET_NEW, ENGINES_RULES.
|
|
29
|
+
allScannersSeverities (List[str]): Severities applied across all scanners.
|
|
30
|
+
Values: CRITICAL, HIGH, MEDIUM, LOW, INFO.
|
|
31
|
+
violatingAssocProjects (Optional[ViolatingAssocProjectsWebDto]):
|
|
32
|
+
Count of associated vs. violating projects.
|
|
33
|
+
netNewScannerMode (Optional[str]): Net-new scanner mode. Values:
|
|
34
|
+
ALL_SCANNERS, BY_SCANNER.
|
|
35
|
+
scannerSeverities (Dict[str, List[str]]): Per-scanner severity lists
|
|
36
|
+
when netNewScannerMode is BY_SCANNER.
|
|
37
|
+
breakBuildExemptStates (List[BreakBuildExemptStateDto]): Result
|
|
38
|
+
states exempt from breaking the build, per rule/scanner.
|
|
39
|
+
defaultPolicy (Optional[bool]): Whether this is the tenant's default policy.
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
name: str
|
|
43
|
+
id: Optional[int] = None
|
|
44
|
+
description: Optional[str] = None
|
|
45
|
+
isActivated: Optional[bool] = None
|
|
46
|
+
tags: List[str] = field(default_factory=list)
|
|
47
|
+
breakBuild: Optional[bool] = None
|
|
48
|
+
pinPolicy: Optional[bool] = None
|
|
49
|
+
lastViolated: Optional[str] = None
|
|
50
|
+
updatedAt: Optional[str] = None
|
|
51
|
+
projects: List[ProjectWebDto] = field(default_factory=list)
|
|
52
|
+
netNewBreakBuild: Optional[bool] = None
|
|
53
|
+
type: Optional[str] = None
|
|
54
|
+
allScannersSeverities: List[str] = field(default_factory=list)
|
|
55
|
+
violatingAssocProjects: Optional[ViolatingAssocProjectsWebDto] = None
|
|
56
|
+
netNewScannerMode: Optional[str] = None
|
|
57
|
+
scannerSeverities: Dict[str, List[str]] = field(default_factory=dict)
|
|
58
|
+
breakBuildExemptStates: List[BreakBuildExemptStateDto] = field(default_factory=list)
|
|
59
|
+
defaultPolicy: Optional[bool] = None
|
|
60
|
+
|
|
61
|
+
@classmethod
|
|
62
|
+
def from_dict(cls, item: dict) -> "PolicyWebDto":
|
|
63
|
+
return cls(
|
|
64
|
+
id=item.get("id"),
|
|
65
|
+
name=item.get("name"),
|
|
66
|
+
description=item.get("description"),
|
|
67
|
+
isActivated=item.get("isActivated"),
|
|
68
|
+
tags=list(item.get("tags") or []),
|
|
69
|
+
breakBuild=item.get("breakBuild"),
|
|
70
|
+
pinPolicy=item.get("pinPolicy"),
|
|
71
|
+
lastViolated=item.get("lastViolated"),
|
|
72
|
+
updatedAt=item.get("updatedAt"),
|
|
73
|
+
projects=[
|
|
74
|
+
ProjectWebDto.from_dict(p) for p in (item.get("projects") or [])
|
|
75
|
+
],
|
|
76
|
+
netNewBreakBuild=item.get("netNewBreakBuild"),
|
|
77
|
+
type=item.get("type"),
|
|
78
|
+
allScannersSeverities=list(item.get("allScannersSeverities") or []),
|
|
79
|
+
violatingAssocProjects=(
|
|
80
|
+
ViolatingAssocProjectsWebDto.from_dict(item["violatingAssocProjects"])
|
|
81
|
+
if item.get("violatingAssocProjects")
|
|
82
|
+
else None
|
|
83
|
+
),
|
|
84
|
+
netNewScannerMode=item.get("netNewScannerMode"),
|
|
85
|
+
scannerSeverities=dict(item.get("scannerSeverities") or {}),
|
|
86
|
+
breakBuildExemptStates=[
|
|
87
|
+
BreakBuildExemptStateDto.from_dict(s)
|
|
88
|
+
for s in (item.get("breakBuildExemptStates") or [])
|
|
89
|
+
],
|
|
90
|
+
defaultPolicy=item.get("defaultPolicy"),
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
def to_dict(self) -> dict:
|
|
94
|
+
# asdict() recursively converts nested dataclasses (projects,
|
|
95
|
+
# violatingAssocProjects, breakBuildExemptStates) to plain dicts;
|
|
96
|
+
# dict_factory drops None values at every nesting level.
|
|
97
|
+
return {
|
|
98
|
+
k: v
|
|
99
|
+
for k, v in asdict(
|
|
100
|
+
self,
|
|
101
|
+
dict_factory=lambda obj: {k: v for k, v in obj if v is not None},
|
|
102
|
+
).items()
|
|
103
|
+
if v is not None
|
|
104
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from dataclasses import dataclass, asdict
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@dataclass
|
|
6
|
+
class ProjectWebDto:
|
|
7
|
+
"""A project reference as used by the Policy Manager service.
|
|
8
|
+
|
|
9
|
+
Attributes:
|
|
10
|
+
astProjectId (str): The CxOne project ID. Required.
|
|
11
|
+
name (Optional[str]): The project name.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
astProjectId: str
|
|
15
|
+
name: Optional[str] = None
|
|
16
|
+
|
|
17
|
+
@classmethod
|
|
18
|
+
def from_dict(cls, item: dict) -> "ProjectWebDto":
|
|
19
|
+
return cls(
|
|
20
|
+
astProjectId=item.get("astProjectId"),
|
|
21
|
+
name=item.get("name"),
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
def to_dict(self) -> dict:
|
|
25
|
+
return {k: v for k, v in asdict(self).items() if v is not None}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from dataclasses import dataclass, field, asdict
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
|
|
4
|
+
from .ProjectWebDto import ProjectWebDto
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class ProjectsInPolicyDto:
|
|
9
|
+
"""Request body for assigning/removing projects on a policy.
|
|
10
|
+
|
|
11
|
+
Used by PUT/DELETE /policies/projects/{policyId}.
|
|
12
|
+
|
|
13
|
+
Attributes:
|
|
14
|
+
projects (List[ProjectWebDto]): Projects to assign or remove.
|
|
15
|
+
id (Optional[int]): The policy ID (also given in the URL path).
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
projects: List[ProjectWebDto] = field(default_factory=list)
|
|
19
|
+
id: Optional[int] = None
|
|
20
|
+
|
|
21
|
+
@classmethod
|
|
22
|
+
def from_dict(cls, item: dict) -> "ProjectsInPolicyDto":
|
|
23
|
+
return cls(
|
|
24
|
+
projects=[
|
|
25
|
+
ProjectWebDto.from_dict(p) for p in (item.get("projects") or [])
|
|
26
|
+
],
|
|
27
|
+
id=item.get("id"),
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
def to_dict(self) -> dict:
|
|
31
|
+
return {
|
|
32
|
+
k: v
|
|
33
|
+
for k, v in asdict(
|
|
34
|
+
self,
|
|
35
|
+
dict_factory=lambda obj: {k: v for k, v in obj if v is not None},
|
|
36
|
+
).items()
|
|
37
|
+
if v is not None
|
|
38
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
|
|
4
|
+
from .FindingsWebDto import FindingsWebDto
|
|
5
|
+
from .PackageWebDto import PackageWebDto
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class RuleViolatedWebDto:
|
|
10
|
+
"""A single policy rule that was violated.
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
ruleName (Optional[str]): The violated rule's name.
|
|
14
|
+
scanner (Optional[str]): The scanner that produced the violation.
|
|
15
|
+
packages (List[PackageWebDto]): SCA packages involved, if any.
|
|
16
|
+
findings (List[FindingsWebDto]): SAST/IaC findings involved, if any.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
ruleName: Optional[str] = None
|
|
20
|
+
scanner: Optional[str] = None
|
|
21
|
+
packages: List[PackageWebDto] = field(default_factory=list)
|
|
22
|
+
findings: List[FindingsWebDto] = field(default_factory=list)
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def from_dict(cls, item: dict) -> "RuleViolatedWebDto":
|
|
26
|
+
return cls(
|
|
27
|
+
ruleName=item.get("ruleName"),
|
|
28
|
+
scanner=item.get("scanner"),
|
|
29
|
+
packages=[
|
|
30
|
+
PackageWebDto.from_dict(p) for p in (item.get("packages") or [])
|
|
31
|
+
],
|
|
32
|
+
findings=[
|
|
33
|
+
FindingsWebDto.from_dict(f) for f in (item.get("findings") or [])
|
|
34
|
+
],
|
|
35
|
+
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@dataclass
|
|
6
|
+
class ScaExportFileFormats:
|
|
7
|
+
"""An entry in the response array of GET /api/sca/export/file-formats
|
|
8
|
+
-- the fileFormat values accepted by one export route.
|
|
9
|
+
"""
|
|
10
|
+
route: Optional[str] = None # e.g. "/requests", "/queries"
|
|
11
|
+
file_formats: List[str] = field(default_factory=list)
|
|
12
|
+
|
|
13
|
+
@classmethod
|
|
14
|
+
def from_dict(cls, item: dict) -> "ScaExportFileFormats":
|
|
15
|
+
return cls(
|
|
16
|
+
route=item.get("route"),
|
|
17
|
+
file_formats=list(item.get("fileFormats") or []),
|
|
18
|
+
)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@dataclass
|
|
6
|
+
class ScaExportStatus:
|
|
7
|
+
"""Response from GET /api/sca/export/requests?exportId={exportId}
|
|
8
|
+
-- status and download link for an SCA export request created via
|
|
9
|
+
ReportAPI.create_sca_scan_report.
|
|
10
|
+
"""
|
|
11
|
+
export_id: Optional[str] = None
|
|
12
|
+
export_status: Optional[str] = None # Pending, Exporting, Completed, Failed
|
|
13
|
+
file_url: Optional[str] = None # only set when export_status is Completed
|
|
14
|
+
error_message: Optional[str] = None
|
|
15
|
+
|
|
16
|
+
@classmethod
|
|
17
|
+
def from_dict(cls, item: dict) -> "ScaExportStatus":
|
|
18
|
+
return cls(
|
|
19
|
+
export_id=item.get("exportId"),
|
|
20
|
+
export_status=item.get("exportStatus"),
|
|
21
|
+
file_url=item.get("fileUrl"),
|
|
22
|
+
error_message=item.get("errorMessage"),
|
|
23
|
+
)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
|
|
4
|
+
from .RuleViolatedWebDto import RuleViolatedWebDto
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class ViolatedPolicyWebDto:
|
|
9
|
+
"""A policy that was violated by a scan, with the rules that triggered it.
|
|
10
|
+
|
|
11
|
+
Attributes:
|
|
12
|
+
policyName (Optional[str]): The violated policy's name.
|
|
13
|
+
description (Optional[str]): The policy's description.
|
|
14
|
+
tags (List[str]): The policy's tags.
|
|
15
|
+
breakBuild (Optional[bool]): Whether this policy breaks the build.
|
|
16
|
+
rulesViolated (List[RuleViolatedWebDto]): The rules that were violated.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
policyName: Optional[str] = None
|
|
20
|
+
description: Optional[str] = None
|
|
21
|
+
tags: List[str] = field(default_factory=list)
|
|
22
|
+
breakBuild: Optional[bool] = None
|
|
23
|
+
rulesViolated: List[RuleViolatedWebDto] = field(default_factory=list)
|
|
24
|
+
|
|
25
|
+
@classmethod
|
|
26
|
+
def from_dict(cls, item: dict) -> "ViolatedPolicyWebDto":
|
|
27
|
+
return cls(
|
|
28
|
+
policyName=item.get("policyName"),
|
|
29
|
+
description=item.get("description"),
|
|
30
|
+
tags=list(item.get("tags") or []),
|
|
31
|
+
breakBuild=item.get("breakBuild"),
|
|
32
|
+
rulesViolated=[
|
|
33
|
+
RuleViolatedWebDto.from_dict(r)
|
|
34
|
+
for r in (item.get("rulesViolated") or [])
|
|
35
|
+
],
|
|
36
|
+
)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@dataclass
|
|
6
|
+
class ViolatingAssocProjectsWebDto:
|
|
7
|
+
"""Count of a policy's associated projects vs. those violating it.
|
|
8
|
+
|
|
9
|
+
Attributes:
|
|
10
|
+
assocProjects (Optional[int]): Number of projects the policy applies to.
|
|
11
|
+
violating (Optional[int]): Number of those projects currently violating it.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
assocProjects: Optional[int] = None
|
|
15
|
+
violating: Optional[int] = None
|
|
16
|
+
|
|
17
|
+
@classmethod
|
|
18
|
+
def from_dict(cls, item: dict) -> "ViolatingAssocProjectsWebDto":
|
|
19
|
+
return cls(
|
|
20
|
+
assocProjects=item.get("assocProjects"),
|
|
21
|
+
violating=item.get("violating"),
|
|
22
|
+
)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@dataclass
|
|
6
|
+
class ViolationDetailsDTO:
|
|
7
|
+
"""Describes the policy rule an incident's results violated.
|
|
8
|
+
|
|
9
|
+
Attributes:
|
|
10
|
+
policyName (Optional[str]): Name of the violated policy.
|
|
11
|
+
ruleName (Optional[str]): Name of the violated rule.
|
|
12
|
+
engine (Optional[str]): The scanner engine that produced the violation.
|
|
13
|
+
conditions (List[str]): The rule's conditions.
|
|
14
|
+
breakBuild (Optional[bool]): Whether this violation breaks the build.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
policyName: Optional[str] = None
|
|
18
|
+
ruleName: Optional[str] = None
|
|
19
|
+
engine: Optional[str] = None
|
|
20
|
+
conditions: List[str] = field(default_factory=list)
|
|
21
|
+
breakBuild: Optional[bool] = None
|
|
22
|
+
|
|
23
|
+
@classmethod
|
|
24
|
+
def from_dict(cls, item: dict) -> "ViolationDetailsDTO":
|
|
25
|
+
return cls(
|
|
26
|
+
policyName=item.get("policyName"),
|
|
27
|
+
ruleName=item.get("ruleName"),
|
|
28
|
+
engine=item.get("engine"),
|
|
29
|
+
conditions=list(item.get("conditions") or []),
|
|
30
|
+
breakBuild=item.get("breakBuild"),
|
|
31
|
+
)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@dataclass
|
|
6
|
+
class VulnerabilityWebDto:
|
|
7
|
+
"""An SCA vulnerability as referenced from a policy violation.
|
|
8
|
+
|
|
9
|
+
Attributes:
|
|
10
|
+
id (Optional[str]): Vulnerability ID.
|
|
11
|
+
cveName (Optional[str]): CVE identifier.
|
|
12
|
+
severity (Optional[str]): Severity. Values: CRITICAL, HIGH, MEDIUM, LOW, INFO.
|
|
13
|
+
description (Optional[str]): Vulnerability description.
|
|
14
|
+
packageId (Optional[str]): ID of the package the vulnerability belongs to.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
id: Optional[str] = None
|
|
18
|
+
cveName: Optional[str] = None
|
|
19
|
+
severity: Optional[str] = None
|
|
20
|
+
description: Optional[str] = None
|
|
21
|
+
packageId: Optional[str] = None
|
|
22
|
+
|
|
23
|
+
@classmethod
|
|
24
|
+
def from_dict(cls, item: dict) -> "VulnerabilityWebDto":
|
|
25
|
+
return cls(
|
|
26
|
+
id=item.get("id"),
|
|
27
|
+
cveName=item.get("cveName"),
|
|
28
|
+
severity=item.get("severity"),
|
|
29
|
+
description=item.get("description"),
|
|
30
|
+
packageId=item.get("packageId"),
|
|
31
|
+
)
|
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
from .BreakBuildExemptStateDto import BreakBuildExemptStateDto
|
|
3
|
+
from .ProjectWebDto import ProjectWebDto
|
|
4
|
+
from .ViolatingAssocProjectsWebDto import ViolatingAssocProjectsWebDto
|
|
5
|
+
from .PolicyWebDto import PolicyWebDto
|
|
6
|
+
from .PolicyShortWebDto import PolicyShortWebDto
|
|
7
|
+
from .ProjectsInPolicyDto import ProjectsInPolicyDto
|
|
8
|
+
from .PoliciesPaginationDto import PoliciesPaginationDto
|
|
9
|
+
from .FindingsWebDto import FindingsWebDto
|
|
10
|
+
from .VulnerabilityWebDto import VulnerabilityWebDto
|
|
11
|
+
from .PackageWebDto import PackageWebDto
|
|
12
|
+
from .RuleViolatedWebDto import RuleViolatedWebDto
|
|
13
|
+
from .ViolatedPolicyWebDto import ViolatedPolicyWebDto
|
|
14
|
+
from .PolicyViolationWebDto import PolicyViolationWebDto
|
|
15
|
+
from .IncidentWebDto import IncidentWebDto
|
|
16
|
+
from .IncidentsPaginationDto import IncidentsPaginationDto
|
|
17
|
+
from .EnhancedIncidentsWebDTO import EnhancedIncidentsWebDTO
|
|
18
|
+
from .EnhancedIncidentsPaginationDTO import EnhancedIncidentsPaginationDTO
|
|
19
|
+
from .ViolationDetailsDTO import ViolationDetailsDTO
|
|
20
|
+
from .IncidentResultWebDTO import IncidentResultWebDTO
|
|
21
|
+
from .IncidentResultsDTO import IncidentResultsDTO
|
|
22
|
+
from .EvaluatedPolicyWebDto import EvaluatedPolicyWebDto
|
|
23
|
+
from .PoliciesResultWebDto import PoliciesResultWebDto
|
|
2
24
|
from .AiTriageInsight import AiTriageInsight
|
|
3
25
|
from .RemediationInsight import RemediationInsight
|
|
4
26
|
from .Risk import Risk
|
|
@@ -26,6 +48,8 @@ from .AiRemediationDetails import AiRemediationDetails
|
|
|
26
48
|
from .ConfidenceScore import ConfidenceScore
|
|
27
49
|
from .ReachabilityAnalysis import ReachabilityAnalysis
|
|
28
50
|
from .ExploitabilityAnalysis import ExploitabilityAnalysis
|
|
51
|
+
from .ExportParametersSbom import ExportParametersSbom
|
|
52
|
+
from .ExportParametersScanReport import ExportParametersScanReport
|
|
29
53
|
from .TriageAnalysis import TriageAnalysis
|
|
30
54
|
from .VulnerabilityMetadata import VulnerabilityMetadata
|
|
31
55
|
from .VerificationStep import VerificationStep
|
|
@@ -289,6 +313,8 @@ from .RuleInput import RuleInput
|
|
|
289
313
|
from .SastResult import SastResult
|
|
290
314
|
from .SastScan import SastScan
|
|
291
315
|
from .SastStatus import SastStatus
|
|
316
|
+
from .ScaExportStatus import ScaExportStatus
|
|
317
|
+
from .ScaExportFileFormats import ScaExportFileFormats
|
|
292
318
|
from .ScaContainersCounters import ScaContainersCounters
|
|
293
319
|
from .ScaCounters import ScaCounters
|
|
294
320
|
from .Scan import Scan
|