devsecops-engine-tools 1.92.0__py3-none-any.whl → 1.93.0__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.
Potentially problematic release.
This version of devsecops-engine-tools might be problematic. Click here for more details.
- devsecops_engine_tools/engine_core/src/applications/runner_engine_core.py +11 -2
- devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/cdxgen/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/cdxgen/cdxgen.py +123 -0
- devsecops_engine_tools/engine_core/src/infrastructure/entry_points/entry_point_core.py +1 -1
- devsecops_engine_tools/version.py +1 -1
- {devsecops_engine_tools-1.92.0.dist-info → devsecops_engine_tools-1.93.0.dist-info}/METADATA +1 -1
- {devsecops_engine_tools-1.92.0.dist-info → devsecops_engine_tools-1.93.0.dist-info}/RECORD +10 -8
- {devsecops_engine_tools-1.92.0.dist-info → devsecops_engine_tools-1.93.0.dist-info}/WHEEL +0 -0
- {devsecops_engine_tools-1.92.0.dist-info → devsecops_engine_tools-1.93.0.dist-info}/entry_points.txt +0 -0
- {devsecops_engine_tools-1.92.0.dist-info → devsecops_engine_tools-1.93.0.dist-info}/top_level.txt +0 -0
|
@@ -22,7 +22,13 @@ from devsecops_engine_tools.engine_core.src.infrastructure.driven_adapters.aws.s
|
|
|
22
22
|
from devsecops_engine_tools.engine_core.src.infrastructure.driven_adapters.printer_pretty_table.printer_pretty_table import (
|
|
23
23
|
PrinterPrettyTable,
|
|
24
24
|
)
|
|
25
|
-
from devsecops_engine_tools.engine_core.src.infrastructure.driven_adapters.syft.syft import
|
|
25
|
+
from devsecops_engine_tools.engine_core.src.infrastructure.driven_adapters.syft.syft import (
|
|
26
|
+
Syft
|
|
27
|
+
)
|
|
28
|
+
from devsecops_engine_tools.engine_core.src.infrastructure.driven_adapters.cdxgen.cdxgen import (
|
|
29
|
+
CdxGen
|
|
30
|
+
)
|
|
31
|
+
|
|
26
32
|
import sys
|
|
27
33
|
import argparse
|
|
28
34
|
from devsecops_engine_tools.engine_utilities.utils.logger_info import MyLogger
|
|
@@ -285,7 +291,10 @@ def application_core():
|
|
|
285
291
|
}.get(args["remote_config_source"])
|
|
286
292
|
metrics_manager_gateway = S3Manager()
|
|
287
293
|
printer_table_gateway = PrinterPrettyTable()
|
|
288
|
-
sbom_tool_gateway =
|
|
294
|
+
sbom_tool_gateway = {
|
|
295
|
+
"syft": Syft(),
|
|
296
|
+
"cdxgen": CdxGen()
|
|
297
|
+
}
|
|
289
298
|
|
|
290
299
|
init_engine_core(
|
|
291
300
|
vulnerability_management_gateway,
|
|
File without changes
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
import requests
|
|
3
|
+
import subprocess
|
|
4
|
+
import platform
|
|
5
|
+
|
|
6
|
+
from devsecops_engine_tools.engine_core.src.domain.model.gateway.sbom_manager import (
|
|
7
|
+
SbomManagerGateway,
|
|
8
|
+
)
|
|
9
|
+
from devsecops_engine_tools.engine_utilities.sbom.deserealizator import (
|
|
10
|
+
get_list_component,
|
|
11
|
+
)
|
|
12
|
+
from devsecops_engine_tools.engine_core.src.domain.model.component import (
|
|
13
|
+
Component,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
from devsecops_engine_tools.engine_utilities.utils.logger_info import MyLogger
|
|
17
|
+
from devsecops_engine_tools.engine_utilities import settings
|
|
18
|
+
|
|
19
|
+
logger = MyLogger.__call__(**settings.SETTING_LOGGER).get_logger()
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass
|
|
23
|
+
class CdxGen(SbomManagerGateway):
|
|
24
|
+
|
|
25
|
+
def get_components(self, artifact, config, service_name) -> "list[Component]":
|
|
26
|
+
try:
|
|
27
|
+
cdxgen_version = config["CDXGEN"]["CDXGEN_VERSION"]
|
|
28
|
+
slim = "-slim" if config["CDXGEN"]["SLIM_BINARY"] else ""
|
|
29
|
+
os_platform = platform.system()
|
|
30
|
+
base_url = (
|
|
31
|
+
f"https://github.com/CycloneDX/cdxgen/releases/download/v{cdxgen_version}/"
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
command_prefix = "cdxgen"
|
|
35
|
+
if os_platform == "Linux":
|
|
36
|
+
file = f"cdxgen-linux-amd64{slim}"
|
|
37
|
+
command_prefix = self._install_tool_unix(
|
|
38
|
+
file, base_url + file, command_prefix
|
|
39
|
+
)
|
|
40
|
+
elif os_platform == "Darwin":
|
|
41
|
+
file = f"cdxgen-darwin-amd64{slim}"
|
|
42
|
+
command_prefix = self._install_tool_unix(
|
|
43
|
+
file, base_url + file, command_prefix
|
|
44
|
+
)
|
|
45
|
+
elif os_platform == "Windows":
|
|
46
|
+
file = f"cdxgen-windows-amd64{slim}.exe"
|
|
47
|
+
command_prefix = self._install_tool_windows(
|
|
48
|
+
file, base_url + file, "cdxgen.exe"
|
|
49
|
+
)
|
|
50
|
+
else:
|
|
51
|
+
logger.warning(f"{os_platform} is not supported.")
|
|
52
|
+
return None
|
|
53
|
+
|
|
54
|
+
result_sbom = self._run_cdxgen(command_prefix, artifact, service_name)
|
|
55
|
+
return get_list_component(result_sbom, config["CDXGEN"]["OUTPUT_FORMAT"])
|
|
56
|
+
except Exception as e:
|
|
57
|
+
logger.error(f"Error generating SBOM: {e}")
|
|
58
|
+
return None
|
|
59
|
+
|
|
60
|
+
def _run_cdxgen(self, command_prefix, artifact, service_name):
|
|
61
|
+
result_file = f"{service_name}_SBOM.json"
|
|
62
|
+
command = [
|
|
63
|
+
command_prefix,
|
|
64
|
+
artifact,
|
|
65
|
+
"-o",
|
|
66
|
+
result_file,
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
try:
|
|
70
|
+
subprocess.run(
|
|
71
|
+
command,
|
|
72
|
+
check=True,
|
|
73
|
+
stdout=subprocess.PIPE,
|
|
74
|
+
stderr=subprocess.PIPE,
|
|
75
|
+
text=True,
|
|
76
|
+
)
|
|
77
|
+
print(f"SBOM generated and saved to: {result_file}")
|
|
78
|
+
return result_file
|
|
79
|
+
except Exception as e:
|
|
80
|
+
logger.error(f"Error running cdxgen: {e}")
|
|
81
|
+
|
|
82
|
+
def _install_tool_unix(self, file, url, command_prefix):
|
|
83
|
+
installed = subprocess.run(
|
|
84
|
+
["which", command_prefix],
|
|
85
|
+
stdout=subprocess.PIPE,
|
|
86
|
+
stderr=subprocess.PIPE,
|
|
87
|
+
)
|
|
88
|
+
if installed.returncode == 1:
|
|
89
|
+
try:
|
|
90
|
+
self._download_tool(file, url)
|
|
91
|
+
subprocess.run(
|
|
92
|
+
["chmod", "+x", f"./{file}"],
|
|
93
|
+
stdout=subprocess.PIPE,
|
|
94
|
+
stderr=subprocess.PIPE,
|
|
95
|
+
)
|
|
96
|
+
return f"./{file}"
|
|
97
|
+
except Exception as e:
|
|
98
|
+
logger.error(f"Error installing cdxgen: {e}")
|
|
99
|
+
else:
|
|
100
|
+
return installed.stdout.decode("utf-8").strip()
|
|
101
|
+
|
|
102
|
+
def _install_tool_windows(self, file, url, command_prefix):
|
|
103
|
+
try:
|
|
104
|
+
installed = subprocess.run(
|
|
105
|
+
[command_prefix, "--version"],
|
|
106
|
+
stdout=subprocess.PIPE,
|
|
107
|
+
stderr=subprocess.PIPE,
|
|
108
|
+
)
|
|
109
|
+
return installed.stdout.decode("utf-8").strip()
|
|
110
|
+
except:
|
|
111
|
+
try:
|
|
112
|
+
self._download_tool(file, url)
|
|
113
|
+
return f"{file}"
|
|
114
|
+
except Exception as e:
|
|
115
|
+
logger.error(f"Error installing cdxgen: {e}")
|
|
116
|
+
|
|
117
|
+
def _download_tool(self, file, url):
|
|
118
|
+
try:
|
|
119
|
+
response = requests.get(url, allow_redirects=True)
|
|
120
|
+
with open(file, "wb") as compress_file:
|
|
121
|
+
compress_file.write(response.content)
|
|
122
|
+
except Exception as e:
|
|
123
|
+
logger.error(f"Error downloading cdxgen: {e}")
|
|
@@ -14,7 +14,6 @@ from devsecops_engine_tools.engine_utilities.utils.printers import (
|
|
|
14
14
|
Printers,
|
|
15
15
|
)
|
|
16
16
|
|
|
17
|
-
|
|
18
17
|
def init_engine_core(
|
|
19
18
|
vulnerability_management_gateway: any,
|
|
20
19
|
secrets_manager_gateway: any,
|
|
@@ -29,6 +28,7 @@ def init_engine_core(
|
|
|
29
28
|
args["remote_config_repo"], "/engine_core/ConfigTool.json", args["remote_config_branch"]
|
|
30
29
|
)
|
|
31
30
|
Printers.print_logo_tool(config_tool["BANNER"])
|
|
31
|
+
sbom_tool_gateway = sbom_tool_gateway.get(config_tool["SBOM_MANAGER"]["TOOL"].lower())
|
|
32
32
|
|
|
33
33
|
if config_tool[args["module"].upper()]["ENABLED"]:
|
|
34
34
|
if args["module"] == "engine_risk":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
version = '1.
|
|
1
|
+
version = '1.93.0'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
devsecops_engine_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
devsecops_engine_tools/version.py,sha256=
|
|
2
|
+
devsecops_engine_tools/version.py,sha256=Cq2d_sTJlpopO1NPuYFPni1ALB_Qz7XCbOThymniec8,19
|
|
3
3
|
devsecops_engine_tools/engine_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
devsecops_engine_tools/engine_core/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
devsecops_engine_tools/engine_core/src/applications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
devsecops_engine_tools/engine_core/src/applications/runner_engine_core.py,sha256=
|
|
6
|
+
devsecops_engine_tools/engine_core/src/applications/runner_engine_core.py,sha256=tw8E4AVN7SL1bLfqVe_XPJ2pZT5AN8N1KEIfo6Itwpk,10770
|
|
7
7
|
devsecops_engine_tools/engine_core/src/deployment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
devsecops_engine_tools/engine_core/src/deployment/infrastructure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
devsecops_engine_tools/engine_core/src/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -37,6 +37,8 @@ devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/aws/s3_man
|
|
|
37
37
|
devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/aws/secrets_manager.py,sha256=ELihQBgSPH4f9QCyg2dgjudsFitaqgdsljnVOmaA_v4,1972
|
|
38
38
|
devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/azure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
39
|
devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/azure/azure_devops.py,sha256=dKe8hno53uC7JDzRWeBdBeRbDHAasEYLxVaFSvWUVxU,5863
|
|
40
|
+
devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/cdxgen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
41
|
+
devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/cdxgen/cdxgen.py,sha256=t1CTeQG2ePBwUdeNinSYEi3vyMjufD0KuHUIxRZCsAU,4370
|
|
40
42
|
devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/defect_dojo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
41
43
|
devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/defect_dojo/defect_dojo.py,sha256=ZjtlXKAhAwHCSJTkA2X0Z-4utoCY6lvipqYJ6gkk6OU,32417
|
|
42
44
|
devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/github/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -50,7 +52,7 @@ devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/runtime_lo
|
|
|
50
52
|
devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/syft/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
51
53
|
devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/syft/syft.py,sha256=hP5MitHTeZf3Ia-xwi5bUdIU5hIwbUNuDSzcsqlxG5c,4457
|
|
52
54
|
devsecops_engine_tools/engine_core/src/infrastructure/entry_points/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
|
-
devsecops_engine_tools/engine_core/src/infrastructure/entry_points/entry_point_core.py,sha256=
|
|
55
|
+
devsecops_engine_tools/engine_core/src/infrastructure/entry_points/entry_point_core.py,sha256=BjA2jQfWpZrCfk9tpaZFL2A8dSKj26p-zIP61GBLqXk,2627
|
|
54
56
|
devsecops_engine_tools/engine_core/src/infrastructure/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
55
57
|
devsecops_engine_tools/engine_core/src/infrastructure/helpers/aws.py,sha256=wfy_PosHS0rrvkdiUYczxIcc8ZNwfqzWwqVxrmRTCBI,264
|
|
56
58
|
devsecops_engine_tools/engine_core/src/infrastructure/helpers/util.py,sha256=lDtaozInb5m2R8Y-oGQasroksCRw_N_Ltz7gLkSguX8,380
|
|
@@ -360,8 +362,8 @@ devsecops_engine_tools/engine_utilities/utils/name_conversion.py,sha256=ADJrRGax
|
|
|
360
362
|
devsecops_engine_tools/engine_utilities/utils/printers.py,sha256=amYAr9YQfYgR6jK9a2l26z3oovFPQ3FAKmhq6BKhEBA,623
|
|
361
363
|
devsecops_engine_tools/engine_utilities/utils/session_manager.py,sha256=Z0fdhB3r-dxU0nGSD9zW_B4r2Qol1rUnUCkhFR0U-HQ,487
|
|
362
364
|
devsecops_engine_tools/engine_utilities/utils/utils.py,sha256=HCjS900TBoNcHrC4LaiP-Kf9frVdtagF130qOUgnO2M,6757
|
|
363
|
-
devsecops_engine_tools-1.
|
|
364
|
-
devsecops_engine_tools-1.
|
|
365
|
-
devsecops_engine_tools-1.
|
|
366
|
-
devsecops_engine_tools-1.
|
|
367
|
-
devsecops_engine_tools-1.
|
|
365
|
+
devsecops_engine_tools-1.93.0.dist-info/METADATA,sha256=42BtV6Bz8Uq6qlx9r_987lu22T7LLOqIOD3teQoeX_M,12218
|
|
366
|
+
devsecops_engine_tools-1.93.0.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
|
367
|
+
devsecops_engine_tools-1.93.0.dist-info/entry_points.txt,sha256=OWAww5aBsGeMv0kWhSgVNB0ySKKpYuJd4dly0ikFPkc,283
|
|
368
|
+
devsecops_engine_tools-1.93.0.dist-info/top_level.txt,sha256=ge6y0X_xBAU1aG3EMWFtl9djbVyg5BxuSp2r2Lg6EQU,23
|
|
369
|
+
devsecops_engine_tools-1.93.0.dist-info/RECORD,,
|
|
File without changes
|
{devsecops_engine_tools-1.92.0.dist-info → devsecops_engine_tools-1.93.0.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{devsecops_engine_tools-1.92.0.dist-info → devsecops_engine_tools-1.93.0.dist-info}/top_level.txt
RENAMED
|
File without changes
|