devsecops-engine-tools 1.6.7__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/__init__.py +0 -0
- devsecops_engine_tools/engine_core/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/applications/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/applications/runner_engine_core.py +124 -0
- devsecops_engine_tools/engine_core/src/deployment/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/deployment/infrastructure/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/domain/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/domain/model/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/domain/model/customs_exceptions.py +9 -0
- devsecops_engine_tools/engine_core/src/domain/model/exclusions.py +14 -0
- devsecops_engine_tools/engine_core/src/domain/model/finding.py +20 -0
- devsecops_engine_tools/engine_core/src/domain/model/gateway/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/domain/model/gateway/devops_platform_gateway.py +27 -0
- devsecops_engine_tools/engine_core/src/domain/model/gateway/metrics_manager_gateway.py +7 -0
- devsecops_engine_tools/engine_core/src/domain/model/gateway/printer_table_gateway.py +13 -0
- devsecops_engine_tools/engine_core/src/domain/model/gateway/secrets_manager_gateway.py +7 -0
- devsecops_engine_tools/engine_core/src/domain/model/gateway/vulnerability_management_gateway.py +17 -0
- devsecops_engine_tools/engine_core/src/domain/model/input_core.py +12 -0
- devsecops_engine_tools/engine_core/src/domain/model/level_compliance.py +3 -0
- devsecops_engine_tools/engine_core/src/domain/model/level_vulnerability.py +7 -0
- devsecops_engine_tools/engine_core/src/domain/model/threshold.py +12 -0
- devsecops_engine_tools/engine_core/src/domain/model/vulnerability_management.py +20 -0
- devsecops_engine_tools/engine_core/src/domain/usecases/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/domain/usecases/break_build.py +375 -0
- devsecops_engine_tools/engine_core/src/domain/usecases/handle_scan.py +148 -0
- devsecops_engine_tools/engine_core/src/domain/usecases/metrics_manager.py +59 -0
- devsecops_engine_tools/engine_core/src/infrastructure/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/aws/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/aws/s3_manager.py +52 -0
- devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/aws/secrets_manager.py +40 -0
- devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/azure/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/azure/azure_devops.py +103 -0
- devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/defect_dojo/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/defect_dojo/defect_dojo.py +215 -0
- devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/printer_pretty_table/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/printer_pretty_table/printer_pretty_table.py +84 -0
- devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/runtime_local/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/runtime_local/runtime_local.py +71 -0
- devsecops_engine_tools/engine_core/src/infrastructure/entry_points/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/infrastructure/entry_points/entry_point_core.py +50 -0
- devsecops_engine_tools/engine_core/src/infrastructure/helpers/__init__.py +0 -0
- devsecops_engine_tools/engine_core/src/infrastructure/helpers/aws.py +9 -0
- devsecops_engine_tools/engine_core/src/infrastructure/helpers/util.py +15 -0
- devsecops_engine_tools/engine_dast/__init__.py +0 -0
- devsecops_engine_tools/engine_dast/src/__init__.py +0 -0
- devsecops_engine_tools/engine_dast/src/applications/__init__.py +0 -0
- devsecops_engine_tools/engine_dast/src/deployment/__init__.py +0 -0
- devsecops_engine_tools/engine_dast/src/deployment/infrastructure/__init__.py +0 -0
- devsecops_engine_tools/engine_dast/src/domain/__init__.py +0 -0
- devsecops_engine_tools/engine_dast/src/domain/model/__init__.py +0 -0
- devsecops_engine_tools/engine_dast/src/domain/usecases/__init__.py +0 -0
- devsecops_engine_tools/engine_dast/src/infrastructure/__init__.py +0 -0
- devsecops_engine_tools/engine_dast/src/infrastructure/driven_adapters/__init__.py +0 -0
- devsecops_engine_tools/engine_dast/src/infrastructure/entry_points/__init__.py +0 -0
- devsecops_engine_tools/engine_dast/src/infrastructure/helpers/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_iac/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/applications/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/applications/runner_iac_scan.py +30 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/deployment/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/deployment/infrastructure/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/domain/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/domain/model/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/domain/model/config_tool.py +24 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/domain/model/gateways/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/domain/model/gateways/tool_gateway.py +6 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/domain/usecases/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/domain/usecases/iac_scan.py +130 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/infrastructure/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/infrastructure/driven_adapters/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/infrastructure/driven_adapters/checkov/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/infrastructure/driven_adapters/checkov/checkov_config.py +135 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/infrastructure/driven_adapters/checkov/checkov_deserealizator.py +35 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/infrastructure/driven_adapters/checkov/checkov_tool.py +195 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/infrastructure/entry_points/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/infrastructure/entry_points/entry_point_tool.py +6 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/infrastructure/helpers/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_iac/src/infrastructure/helpers/file_generator_tool.py +74 -0
- devsecops_engine_tools/engine_sast/engine_secret/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/applications/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/applications/runner_secret_scan.py +34 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/deployment/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/deployment/infrastructure/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/domain/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/domain/model/DeserializeConfigTool.py +11 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/domain/model/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/domain/model/gateway/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/domain/model/gateway/gateway_deserealizator.py +11 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/domain/model/gateway/git_gateway.py +15 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/domain/model/gateway/tool_gateway.py +16 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/domain/usecases/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/domain/usecases/secret_scan.py +72 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/domain/usecases/set_input_core.py +73 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/infrastructure/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/infrastructure/driven_adapters/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/infrastructure/driven_adapters/git_cli/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/infrastructure/driven_adapters/git_cli/git_run.py +60 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/infrastructure/driven_adapters/trufflehog/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/infrastructure/driven_adapters/trufflehog/trufflehog_deserealizator.py +39 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/infrastructure/driven_adapters/trufflehog/trufflehog_run.py +104 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/infrastructure/entry_points/__init__.py +0 -0
- devsecops_engine_tools/engine_sast/engine_secret/src/infrastructure/entry_points/entry_point_tool.py +11 -0
- devsecops_engine_tools/engine_sca/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_container/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_container/src/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_container/src/applications/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_container/src/applications/runner_container_scan.py +45 -0
- devsecops_engine_tools/engine_sca/engine_container/src/deployment/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_container/src/deployment/infrastructure/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_container/src/domain/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_container/src/domain/model/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_container/src/domain/model/gateways/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_container/src/domain/model/gateways/deserealizator_gateway.py +8 -0
- devsecops_engine_tools/engine_sca/engine_container/src/domain/model/gateways/images_gateway.py +7 -0
- devsecops_engine_tools/engine_sca/engine_container/src/domain/model/gateways/tool_gateway.py +7 -0
- devsecops_engine_tools/engine_sca/engine_container/src/domain/usecases/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_container/src/domain/usecases/container_sca_scan.py +82 -0
- devsecops_engine_tools/engine_sca/engine_container/src/domain/usecases/handle_remote_config_patterns.py +67 -0
- devsecops_engine_tools/engine_sca/engine_container/src/domain/usecases/set_input_core.py +76 -0
- devsecops_engine_tools/engine_sca/engine_container/src/infrastructure/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_container/src/infrastructure/driven_adapters/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_container/src/infrastructure/driven_adapters/docker/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_container/src/infrastructure/driven_adapters/docker/docker_images.py +22 -0
- devsecops_engine_tools/engine_sca/engine_container/src/infrastructure/driven_adapters/prisma_cloud/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_container/src/infrastructure/driven_adapters/prisma_cloud/prisma_cloud_manager_scan.py +123 -0
- devsecops_engine_tools/engine_sca/engine_container/src/infrastructure/driven_adapters/prisma_cloud/prisma_deserialize_output.py +62 -0
- devsecops_engine_tools/engine_sca/engine_container/src/infrastructure/driven_adapters/trivy_tool/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_container/src/infrastructure/driven_adapters/trivy_tool/trivy_deserialize_output.py +48 -0
- devsecops_engine_tools/engine_sca/engine_container/src/infrastructure/driven_adapters/trivy_tool/trivy_manager_scan.py +114 -0
- devsecops_engine_tools/engine_sca/engine_container/src/infrastructure/entry_points/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_container/src/infrastructure/entry_points/entry_point_tool.py +40 -0
- devsecops_engine_tools/engine_sca/engine_container/src/infrastructure/helpers/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_container/src/infrastructure/helpers/images_scanned.py +16 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/applications/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/applications/runner_dependencies_scan.py +32 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/deployment/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/deployment/infrastructure/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/domain/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/domain/model/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/domain/model/gateways/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/domain/model/gateways/deserializator_gateway.py +8 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/domain/model/gateways/tool_gateway.py +9 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/domain/usecases/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/domain/usecases/dependencies_sca_scan.py +44 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/domain/usecases/find_artifacts.py +95 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/domain/usecases/find_mono_repos.py +29 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/domain/usecases/handle_remote_config_patterns.py +90 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/domain/usecases/set_input_core.py +65 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/infrastructure/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/infrastructure/driven_adapters/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/infrastructure/driven_adapters/xray_tool/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/infrastructure/driven_adapters/xray_tool/xray_deserialize_output.py +57 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/infrastructure/driven_adapters/xray_tool/xray_manager_scan.py +154 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/infrastructure/entry_points/__init__.py +0 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/infrastructure/entry_points/entry_point_tool.py +83 -0
- devsecops_engine_tools/engine_sca/engine_dependencies/src/infrastructure/helpers/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/azuredevops/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/azuredevops/infrastructure/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/azuredevops/infrastructure/azure_devops_api.py +67 -0
- devsecops_engine_tools/engine_utilities/azuredevops/models/AzureMessageLoggingPipeline.py +21 -0
- devsecops_engine_tools/engine_utilities/azuredevops/models/AzurePredefinedVariables.py +65 -0
- devsecops_engine_tools/engine_utilities/azuredevops/models/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/__init__.py +5 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/applications/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/applications/connect.py +37 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/applications/defect_dojo.py +40 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/applications/finding.py +40 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/models/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/models/cmdb.py +11 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/models/engagement.py +55 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/models/finding.py +96 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/models/product.py +35 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/models/product_list.py +12 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/models/product_type.py +16 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/models/product_type_list.py +13 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/models/scan_configuration.py +21 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/request_objects/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/request_objects/finding.py +95 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/request_objects/import_scan.py +125 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/serializers/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/serializers/finding.py +100 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/serializers/import_scan.py +223 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/user_case/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/user_case/cmdb.py +59 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/user_case/finding.py +38 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/domain/user_case/import_scan.py +133 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/hello_world.py +2 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/infraestructure/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/infraestructure/driver_adapters/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/infraestructure/driver_adapters/cmdb.py +55 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/infraestructure/driver_adapters/engagement.py +55 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/infraestructure/driver_adapters/finding.py +37 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/infraestructure/driver_adapters/import_scan.py +115 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/infraestructure/driver_adapters/product.py +50 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/infraestructure/driver_adapters/product_type.py +59 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/infraestructure/driver_adapters/scan_configurations.py +65 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/infraestructure/driver_adapters/settings/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/infraestructure/driver_adapters/settings/settings.py +1 -0
- devsecops_engine_tools/engine_utilities/defect_dojo/infraestructure/repository/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/github/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/github/infrastructure/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/github/infrastructure/github_api.py +49 -0
- devsecops_engine_tools/engine_utilities/github/models/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/input_validations/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/input_validations/env_utils.py +10 -0
- devsecops_engine_tools/engine_utilities/input_validations/validate_input_with_regex_letters_number_and_only.py +8 -0
- devsecops_engine_tools/engine_utilities/settings.py +38 -0
- devsecops_engine_tools/engine_utilities/ssh/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/ssh/managment_private_key.py +67 -0
- devsecops_engine_tools/engine_utilities/utils/__init__.py +0 -0
- devsecops_engine_tools/engine_utilities/utils/api_error.py +14 -0
- devsecops_engine_tools/engine_utilities/utils/dataclass_classmethod.py +84 -0
- devsecops_engine_tools/engine_utilities/utils/datetime_parsing.py +10 -0
- devsecops_engine_tools/engine_utilities/utils/logger_info.py +109 -0
- devsecops_engine_tools/engine_utilities/utils/name_conversion.py +12 -0
- devsecops_engine_tools/engine_utilities/utils/printers.py +21 -0
- devsecops_engine_tools/engine_utilities/utils/session_manager.py +14 -0
- devsecops_engine_tools/version.py +1 -0
- devsecops_engine_tools-1.6.7.dist-info/METADATA +156 -0
- devsecops_engine_tools-1.6.7.dist-info/RECORD +231 -0
- devsecops_engine_tools-1.6.7.dist-info/WHEEL +5 -0
- devsecops_engine_tools-1.6.7.dist-info/entry_points.txt +2 -0
- devsecops_engine_tools-1.6.7.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from devsecops_engine_tools.engine_core.src.domain.model.gateway.devops_platform_gateway import (
|
|
3
|
+
DevopsPlatformGateway,
|
|
4
|
+
)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class HandleRemoteConfigPatterns:
|
|
8
|
+
def __init__(
|
|
9
|
+
self,
|
|
10
|
+
tool_remote: DevopsPlatformGateway,
|
|
11
|
+
dict_args,
|
|
12
|
+
):
|
|
13
|
+
self.tool_remote = tool_remote
|
|
14
|
+
self.dict_args = dict_args
|
|
15
|
+
|
|
16
|
+
def get_remote_config(self, file_path):
|
|
17
|
+
"""
|
|
18
|
+
Get remote configuration
|
|
19
|
+
Return: dict: Remote configuration
|
|
20
|
+
"""
|
|
21
|
+
return self.tool_remote.get_remote_config(
|
|
22
|
+
self.dict_args["remote_config_repo"], file_path
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
def get_variable(self, variable):
|
|
26
|
+
"""
|
|
27
|
+
Get variable.
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
dict: Remote variable.
|
|
31
|
+
"""
|
|
32
|
+
return self.tool_remote.get_variable(variable)
|
|
33
|
+
|
|
34
|
+
def ignore_analysis_pattern(self):
|
|
35
|
+
"""
|
|
36
|
+
Handle analysis pattern.
|
|
37
|
+
Return: bool: False -> not scan, True -> scan.
|
|
38
|
+
"""
|
|
39
|
+
ignore = self.get_remote_config("SCA/CONTAINER/ConfigTool.json")["IGNORE_SEARCH_PATTERN"]
|
|
40
|
+
if re.match(ignore, self.get_variable("release_name"), re.IGNORECASE):
|
|
41
|
+
return False
|
|
42
|
+
else:
|
|
43
|
+
return True
|
|
44
|
+
|
|
45
|
+
def handle_skip_tool(self, exclusions, pipeline_name):
|
|
46
|
+
"""
|
|
47
|
+
Handle skip tool.
|
|
48
|
+
|
|
49
|
+
Return: bool: True -> skip tool, False -> not skip tool.
|
|
50
|
+
"""
|
|
51
|
+
if (pipeline_name in exclusions) and (
|
|
52
|
+
exclusions[pipeline_name].get("SKIP_TOOL", 0)
|
|
53
|
+
):
|
|
54
|
+
return True
|
|
55
|
+
else:
|
|
56
|
+
return False
|
|
57
|
+
|
|
58
|
+
def process_handle_skip_tool(self):
|
|
59
|
+
"""
|
|
60
|
+
Process handle skip tool.
|
|
61
|
+
|
|
62
|
+
Return: bool: True -> skip tool, False -> not skip tool.
|
|
63
|
+
"""
|
|
64
|
+
return self.handle_skip_tool(
|
|
65
|
+
self.get_remote_config("engine_sca/engine_container/Exclusions.json"),
|
|
66
|
+
self.get_variable("pipeline_name"),
|
|
67
|
+
)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
from devsecops_engine_tools.engine_core.src.domain.model.input_core import InputCore
|
|
2
|
+
from devsecops_engine_tools.engine_core.src.domain.model.threshold import Threshold
|
|
3
|
+
from devsecops_engine_tools.engine_core.src.domain.model.gateway.devops_platform_gateway import (
|
|
4
|
+
DevopsPlatformGateway,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
from devsecops_engine_tools.engine_core.src.domain.model.exclusions import Exclusions
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class SetInputCore:
|
|
11
|
+
def __init__(self, tool_remote: DevopsPlatformGateway, dict_args, config_tool):
|
|
12
|
+
self.tool_remote = tool_remote
|
|
13
|
+
self.dict_args = dict_args
|
|
14
|
+
self.config_tool = config_tool
|
|
15
|
+
|
|
16
|
+
def get_remote_config(self, file_path):
|
|
17
|
+
"""
|
|
18
|
+
Get remote configuration.
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
dict: Remote configuration.
|
|
22
|
+
"""
|
|
23
|
+
return self.tool_remote.get_remote_config(self.dict_args["remote_config_repo"], file_path)
|
|
24
|
+
|
|
25
|
+
def get_variable(self, variable):
|
|
26
|
+
"""
|
|
27
|
+
Get variable.
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
dict: Remote variable.
|
|
31
|
+
"""
|
|
32
|
+
return self.tool_remote.get_variable(variable)
|
|
33
|
+
|
|
34
|
+
def get_exclusions(self, exclusions_data, pipeline_name, config_tool):
|
|
35
|
+
list_exclusions = []
|
|
36
|
+
for key, value in exclusions_data.items():
|
|
37
|
+
if (key == "All") or (key == pipeline_name):
|
|
38
|
+
exclusions = [
|
|
39
|
+
Exclusions(
|
|
40
|
+
id=item.get("id", ""),
|
|
41
|
+
where=item.get("where", ""),
|
|
42
|
+
cve_id=item.get("cve_id", ""),
|
|
43
|
+
create_date=item.get("create_date", ""),
|
|
44
|
+
expired_date=item.get("expired_date", ""),
|
|
45
|
+
severity=item.get("severity", ""),
|
|
46
|
+
hu=item.get("hu", ""),
|
|
47
|
+
reason=item.get("reason", "Risk acceptance"),
|
|
48
|
+
)
|
|
49
|
+
for item in value[config_tool["ENGINE_CONTAINER"]["TOOL"]]
|
|
50
|
+
]
|
|
51
|
+
list_exclusions.extend(exclusions)
|
|
52
|
+
return list_exclusions
|
|
53
|
+
|
|
54
|
+
def set_input_core(self, images_scanned):
|
|
55
|
+
"""
|
|
56
|
+
Set the input core.
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
dict: Input core.
|
|
60
|
+
"""
|
|
61
|
+
return InputCore(
|
|
62
|
+
self.get_exclusions(
|
|
63
|
+
self.get_remote_config("engine_sca/engine_container/Exclusions.json"),
|
|
64
|
+
self.get_variable("pipeline_name"),
|
|
65
|
+
self.config_tool,
|
|
66
|
+
),
|
|
67
|
+
Threshold(
|
|
68
|
+
self.get_remote_config("engine_sca/engine_container/ConfigTool.json")["THRESHOLD"]
|
|
69
|
+
),
|
|
70
|
+
images_scanned[-1] if images_scanned else None,
|
|
71
|
+
self.get_remote_config("engine_sca/engine_container/ConfigTool.json")[
|
|
72
|
+
"MESSAGE_INFO_ENGINE_CONTAINER"
|
|
73
|
+
],
|
|
74
|
+
self.get_variable("pipeline_name"),
|
|
75
|
+
self.get_variable("stage").capitalize(),
|
|
76
|
+
)
|
|
File without changes
|
devsecops_engine_tools/engine_sca/engine_container/src/infrastructure/driven_adapters/__init__.py
ADDED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
from devsecops_engine_tools.engine_sca.engine_container.src.domain.model.gateways.images_gateway import (
|
|
3
|
+
ImagesGateway,
|
|
4
|
+
)
|
|
5
|
+
import docker
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class DockerImages(ImagesGateway):
|
|
9
|
+
def list_images(self):
|
|
10
|
+
try:
|
|
11
|
+
client = docker.from_env()
|
|
12
|
+
images = client.images.list()
|
|
13
|
+
images_sorted = sorted(
|
|
14
|
+
images, key=lambda x: x.attrs["Created"], reverse=True
|
|
15
|
+
)
|
|
16
|
+
latest_image = images_sorted[0]
|
|
17
|
+
print("ID last image:", latest_image.id)
|
|
18
|
+
print("Tag last image:", latest_image.tags)
|
|
19
|
+
print("Created date last image:", latest_image.attrs["Created"])
|
|
20
|
+
return latest_image
|
|
21
|
+
except subprocess.CalledProcessError as e:
|
|
22
|
+
raise ValueError(f"Error listing images:{e.stderr}")
|
|
File without changes
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import stat
|
|
2
|
+
import requests
|
|
3
|
+
import os
|
|
4
|
+
import subprocess
|
|
5
|
+
import logging
|
|
6
|
+
import re
|
|
7
|
+
import base64
|
|
8
|
+
from devsecops_engine_tools.engine_sca.engine_container.src.infrastructure.helpers.images_scanned import (
|
|
9
|
+
ImagesScanned,
|
|
10
|
+
)
|
|
11
|
+
from devsecops_engine_tools.engine_sca.engine_container.src.domain.model.gateways.tool_gateway import (
|
|
12
|
+
ToolGateway,
|
|
13
|
+
)
|
|
14
|
+
from devsecops_engine_tools.engine_utilities.utils.logger_info import MyLogger
|
|
15
|
+
from devsecops_engine_tools.engine_utilities import settings
|
|
16
|
+
|
|
17
|
+
logger = MyLogger.__call__(**settings.SETTING_LOGGER).get_logger()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class PrismaCloudManagerScan(ToolGateway):
|
|
21
|
+
def download_twistcli(
|
|
22
|
+
self,
|
|
23
|
+
file_path,
|
|
24
|
+
prisma_access_key,
|
|
25
|
+
prisma_secret_key,
|
|
26
|
+
prisma_console_url,
|
|
27
|
+
prisma_api_version,
|
|
28
|
+
):
|
|
29
|
+
url = f"{prisma_console_url}/api/{prisma_api_version}/util/twistcli"
|
|
30
|
+
credentials = base64.b64encode(
|
|
31
|
+
f"{prisma_access_key}:{prisma_secret_key}".encode()
|
|
32
|
+
).decode()
|
|
33
|
+
headers = {"Authorization": f"Basic {credentials}"}
|
|
34
|
+
try:
|
|
35
|
+
response = requests.get(url, headers=headers)
|
|
36
|
+
response.raise_for_status()
|
|
37
|
+
|
|
38
|
+
with open(file_path, "wb") as file:
|
|
39
|
+
file.write(response.content)
|
|
40
|
+
|
|
41
|
+
os.chmod(file_path, stat.S_IRWXU)
|
|
42
|
+
logging.info(f"twistcli downloaded and saved to: {file_path}")
|
|
43
|
+
return 0
|
|
44
|
+
|
|
45
|
+
except Exception as e:
|
|
46
|
+
raise ValueError(f"Error downloading twistcli: {e}")
|
|
47
|
+
|
|
48
|
+
def scan_image(self, file_path, image, remoteconfig, prisma_secret_key, build_id):
|
|
49
|
+
file_name = "scanned_images.txt"
|
|
50
|
+
image_name = f"{image.tags[0]}"
|
|
51
|
+
result_file = f"{image_name}" + "_scan_result.json"
|
|
52
|
+
images_scanned = []
|
|
53
|
+
|
|
54
|
+
if (result_file) in ImagesScanned.get_images_already_scanned(file_name):
|
|
55
|
+
print(f"The image {image_name} has already been scanned previously.")
|
|
56
|
+
else:
|
|
57
|
+
if build_id in image_name:
|
|
58
|
+
command = (
|
|
59
|
+
file_path,
|
|
60
|
+
"images",
|
|
61
|
+
"scan",
|
|
62
|
+
"--address",
|
|
63
|
+
remoteconfig["PRISMA_CLOUD"]["PRISMA_CONSOLE_URL"],
|
|
64
|
+
"--user",
|
|
65
|
+
remoteconfig["PRISMA_CLOUD"]["PRISMA_ACCESS_KEY"],
|
|
66
|
+
"--password",
|
|
67
|
+
prisma_secret_key,
|
|
68
|
+
"--output-file",
|
|
69
|
+
result_file,
|
|
70
|
+
"--details",
|
|
71
|
+
image_name,
|
|
72
|
+
)
|
|
73
|
+
try:
|
|
74
|
+
subprocess.run(
|
|
75
|
+
command,
|
|
76
|
+
check=True,
|
|
77
|
+
stdout=subprocess.PIPE,
|
|
78
|
+
stderr=subprocess.PIPE,
|
|
79
|
+
text=True,
|
|
80
|
+
)
|
|
81
|
+
images_scanned.append(result_file)
|
|
82
|
+
print(f"The image {image_name} was scanned")
|
|
83
|
+
with open(file_name, "a") as file:
|
|
84
|
+
file.write(result_file + "\n")
|
|
85
|
+
except subprocess.CalledProcessError as e:
|
|
86
|
+
logger.error(f"Error during image scan of {image_name}: {e.stderr}")
|
|
87
|
+
|
|
88
|
+
return images_scanned
|
|
89
|
+
|
|
90
|
+
def run_tool_container_sca(
|
|
91
|
+
self, remoteconfig, prisma_secret_key, image, build_id, skip_flag
|
|
92
|
+
):
|
|
93
|
+
images_scanned = []
|
|
94
|
+
if not (skip_flag):
|
|
95
|
+
try:
|
|
96
|
+
file_path = os.path.join(
|
|
97
|
+
os.getcwd(), remoteconfig["PRISMA_CLOUD"]["TWISTCLI_PATH"]
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
if not os.path.exists(file_path):
|
|
101
|
+
self.download_twistcli(
|
|
102
|
+
file_path,
|
|
103
|
+
remoteconfig["PRISMA_CLOUD"]["PRISMA_ACCESS_KEY"],
|
|
104
|
+
prisma_secret_key,
|
|
105
|
+
remoteconfig["PRISMA_CLOUD"]["PRISMA_CONSOLE_URL"],
|
|
106
|
+
remoteconfig["PRISMA_CLOUD"]["PRISMA_API_VERSION"],
|
|
107
|
+
)
|
|
108
|
+
images_scanned.extend(
|
|
109
|
+
self.scan_image(
|
|
110
|
+
file_path,
|
|
111
|
+
image,
|
|
112
|
+
remoteconfig,
|
|
113
|
+
prisma_secret_key,
|
|
114
|
+
build_id,
|
|
115
|
+
)
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
return images_scanned
|
|
119
|
+
|
|
120
|
+
except Exception as ex:
|
|
121
|
+
logger.error(f"An overall error occurred: {ex}")
|
|
122
|
+
|
|
123
|
+
return images_scanned
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from devsecops_engine_tools.engine_sca.engine_container.src.domain.model.gateways.deserealizator_gateway import (
|
|
2
|
+
DeseralizatorGateway,
|
|
3
|
+
)
|
|
4
|
+
from devsecops_engine_tools.engine_core.src.domain.model.finding import (
|
|
5
|
+
Finding,
|
|
6
|
+
Category,
|
|
7
|
+
)
|
|
8
|
+
from datetime import datetime
|
|
9
|
+
from dataclasses import dataclass
|
|
10
|
+
import json
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass
|
|
14
|
+
class PrismaDeserealizator(DeseralizatorGateway):
|
|
15
|
+
def get_list_findings(self, images_scanned: list) -> "list[Finding]":
|
|
16
|
+
list_open_vulnerabilities = []
|
|
17
|
+
SEVERITY_MAP = {
|
|
18
|
+
"unimportant": "low",
|
|
19
|
+
"unassigned": "low",
|
|
20
|
+
"negligible": "low",
|
|
21
|
+
"not yet assigned": "low",
|
|
22
|
+
"low": "low",
|
|
23
|
+
"medium": "medium",
|
|
24
|
+
"moderate": "medium",
|
|
25
|
+
"high": "high",
|
|
26
|
+
"important": "high",
|
|
27
|
+
"critical": "critical",
|
|
28
|
+
}
|
|
29
|
+
for image in images_scanned:
|
|
30
|
+
with open(image, "rb") as file:
|
|
31
|
+
image_object = file.read()
|
|
32
|
+
|
|
33
|
+
json_data = json.loads(image_object)
|
|
34
|
+
|
|
35
|
+
vulnerabilities_data = json_data["results"][0]["vulnerabilities"]
|
|
36
|
+
|
|
37
|
+
# Create a list of findings instances from the JSON data
|
|
38
|
+
vulnerabilities = [
|
|
39
|
+
Finding(
|
|
40
|
+
id=vul.get("id", ""),
|
|
41
|
+
cvss=float(vul.get("cvss", 0.0)),
|
|
42
|
+
where=vul.get("packageName", "")
|
|
43
|
+
+ ":"
|
|
44
|
+
+ vul.get("packageVersion", ""),
|
|
45
|
+
description=vul.get("description", "")[:150],
|
|
46
|
+
severity=SEVERITY_MAP.get(vul.get("severity", ""), ""),
|
|
47
|
+
identification_date=datetime.strptime(
|
|
48
|
+
vul.get("discoveredDate", ""), "%Y-%m-%dT%H:%M:%S%z"
|
|
49
|
+
),
|
|
50
|
+
published_date_cve=vul.get("publishedDate", None),
|
|
51
|
+
module="engine_container",
|
|
52
|
+
category=Category.VULNERABILITY,
|
|
53
|
+
requirements=vul.get("status", ""),
|
|
54
|
+
tool="PrismaCloud",
|
|
55
|
+
)
|
|
56
|
+
for vul in vulnerabilities_data
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
# Add the Vulnerability instances to the list
|
|
60
|
+
list_open_vulnerabilities.extend(vulnerabilities)
|
|
61
|
+
|
|
62
|
+
return list_open_vulnerabilities
|
|
File without changes
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from devsecops_engine_tools.engine_sca.engine_container.src.domain.model.gateways.deserealizator_gateway import (
|
|
2
|
+
DeseralizatorGateway,
|
|
3
|
+
)
|
|
4
|
+
from devsecops_engine_tools.engine_core.src.domain.model.finding import (
|
|
5
|
+
Finding,
|
|
6
|
+
Category,
|
|
7
|
+
)
|
|
8
|
+
from dataclasses import dataclass
|
|
9
|
+
import json
|
|
10
|
+
from datetime import datetime
|
|
11
|
+
|
|
12
|
+
@dataclass
|
|
13
|
+
class TrivyDeserializator(DeseralizatorGateway):
|
|
14
|
+
def get_list_findings(self, images_scanned: list) -> "list[Finding]":
|
|
15
|
+
list_open_vulnerabilities = []
|
|
16
|
+
for image in images_scanned:
|
|
17
|
+
with open(image, "rb") as file:
|
|
18
|
+
image_object = file.read()
|
|
19
|
+
json_data = json.loads(image_object)
|
|
20
|
+
vulnerabilities_data = json_data["Results"][0]["Vulnerabilities"]
|
|
21
|
+
vulnerabilities = [
|
|
22
|
+
Finding(
|
|
23
|
+
id=vul.get("VulnerabilityID", ""),
|
|
24
|
+
cvss=next(
|
|
25
|
+
(
|
|
26
|
+
v["V3Score"]
|
|
27
|
+
for v in vul["CVSS"].values()
|
|
28
|
+
if "V3Score" in v
|
|
29
|
+
),
|
|
30
|
+
None,
|
|
31
|
+
),
|
|
32
|
+
where=vul.get("PkgName", "")
|
|
33
|
+
+ " "
|
|
34
|
+
+ vul.get("InstalledVersion", ""),
|
|
35
|
+
description=vul.get("Description", "").replace("\n", ""),
|
|
36
|
+
severity=vul.get("Severity", "").lower(),
|
|
37
|
+
identification_date=datetime.now().strftime("%d-%m-%Y %H:%M:%S"),
|
|
38
|
+
published_date_cve=vul.get("PublishedDate", ""),
|
|
39
|
+
module="engine_container",
|
|
40
|
+
category=Category.VULNERABILITY,
|
|
41
|
+
requirements=vul.get("FixedVersion") or vul.get("Status", ""),
|
|
42
|
+
tool="Trivy",
|
|
43
|
+
)
|
|
44
|
+
for vul in vulnerabilities_data
|
|
45
|
+
if "CVSS" in vul
|
|
46
|
+
]
|
|
47
|
+
list_open_vulnerabilities.extend(vulnerabilities)
|
|
48
|
+
return list_open_vulnerabilities
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
import re
|
|
3
|
+
|
|
4
|
+
from devsecops_engine_tools.engine_sca.engine_container.src.domain.model.gateways.tool_gateway import (
|
|
5
|
+
ToolGateway,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
from devsecops_engine_tools.engine_sca.engine_container.src.infrastructure.helpers.images_scanned import (
|
|
9
|
+
ImagesScanned,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
from devsecops_engine_tools.engine_utilities.utils.logger_info import MyLogger
|
|
13
|
+
from devsecops_engine_tools.engine_utilities import settings
|
|
14
|
+
|
|
15
|
+
logger = MyLogger.__call__(**settings.SETTING_LOGGER).get_logger()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class TrivyScan(ToolGateway):
|
|
19
|
+
def install_tool(self, version):
|
|
20
|
+
installed = subprocess.run(
|
|
21
|
+
["which", "trivy"],
|
|
22
|
+
stdout=subprocess.PIPE,
|
|
23
|
+
stderr=subprocess.PIPE,
|
|
24
|
+
)
|
|
25
|
+
if installed.returncode == 1:
|
|
26
|
+
try:
|
|
27
|
+
command1 = [
|
|
28
|
+
"wget",
|
|
29
|
+
"https://github.com/aquasecurity/trivy/releases/download/v"
|
|
30
|
+
+ version
|
|
31
|
+
+ "/trivy_"
|
|
32
|
+
+ version
|
|
33
|
+
+ "_Linux-64bit.deb",
|
|
34
|
+
]
|
|
35
|
+
subprocess.run(
|
|
36
|
+
command1, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
37
|
+
)
|
|
38
|
+
command2 = [
|
|
39
|
+
"sudo",
|
|
40
|
+
"dpkg",
|
|
41
|
+
"-i",
|
|
42
|
+
"trivy_" + version + "_Linux-64bit.deb",
|
|
43
|
+
]
|
|
44
|
+
subprocess.run(
|
|
45
|
+
command2, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
46
|
+
)
|
|
47
|
+
except subprocess.CalledProcessError as error:
|
|
48
|
+
raise RuntimeError(f"Error al instalar trivy: {error}")
|
|
49
|
+
|
|
50
|
+
def scan_image(self, repository, tag, remoteconfig, release):
|
|
51
|
+
file_name = "scanned_images.txt"
|
|
52
|
+
repo = repository.split("/")[1] if len(repository.split("/")) >= 2 else ""
|
|
53
|
+
image_name = f"{repository}:{tag}"
|
|
54
|
+
result_file = f"{repo}:{tag}" + "_scan_result.json"
|
|
55
|
+
images_scanned = []
|
|
56
|
+
|
|
57
|
+
if not ((result_file) in ImagesScanned.get_images_already_scanned(file_name)):
|
|
58
|
+
pattern = remoteconfig["REGEX_EXPRESSION_PROJECTS"]
|
|
59
|
+
match = re.match(pattern, repo.upper())
|
|
60
|
+
if match:
|
|
61
|
+
if match.group() in release.upper():
|
|
62
|
+
command1 = ["trivy", "image", "--download-db-only"]
|
|
63
|
+
command2 = [
|
|
64
|
+
"trivy",
|
|
65
|
+
"--scanners",
|
|
66
|
+
"vuln",
|
|
67
|
+
"-f",
|
|
68
|
+
"json",
|
|
69
|
+
"-o",
|
|
70
|
+
result_file,
|
|
71
|
+
]
|
|
72
|
+
command2.extend(["--quiet", "image", image_name])
|
|
73
|
+
try:
|
|
74
|
+
subprocess.run(
|
|
75
|
+
command1,
|
|
76
|
+
check=True,
|
|
77
|
+
stdout=subprocess.PIPE,
|
|
78
|
+
stderr=subprocess.PIPE,
|
|
79
|
+
)
|
|
80
|
+
subprocess.run(
|
|
81
|
+
command2,
|
|
82
|
+
check=True,
|
|
83
|
+
stdout=subprocess.PIPE,
|
|
84
|
+
stderr=subprocess.PIPE,
|
|
85
|
+
text=True,
|
|
86
|
+
)
|
|
87
|
+
images_scanned.append(result_file)
|
|
88
|
+
with open(file_name, "a") as file:
|
|
89
|
+
file.write(result_file + "\n")
|
|
90
|
+
except subprocess.CalledProcessError as e:
|
|
91
|
+
logger.error(
|
|
92
|
+
f"Error during image scan of {repository}: {e.stderr}"
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
return images_scanned
|
|
96
|
+
|
|
97
|
+
def run_tool_container_sca(self, remoteconfig, token, scan_image, release):
|
|
98
|
+
try:
|
|
99
|
+
trivy_version = remoteconfig["TRIVY"]["TRIVY_VERSION"]
|
|
100
|
+
self.install_tool(trivy_version)
|
|
101
|
+
images_scanned = []
|
|
102
|
+
|
|
103
|
+
for image in scan_image:
|
|
104
|
+
repository, tag = image["Repository"], image["Tag"]
|
|
105
|
+
images_scanned.extend(
|
|
106
|
+
self.scan_image(repository, tag, remoteconfig, release)
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
return images_scanned
|
|
110
|
+
|
|
111
|
+
except Exception as ex:
|
|
112
|
+
logger.error(f"An overall error occurred: {ex}")
|
|
113
|
+
|
|
114
|
+
return 0
|
devsecops_engine_tools/engine_sca/engine_container/src/infrastructure/entry_points/__init__.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from devsecops_engine_tools.engine_sca.engine_container.src.domain.usecases.container_sca_scan import (
|
|
2
|
+
ContainerScaScan,
|
|
3
|
+
)
|
|
4
|
+
from devsecops_engine_tools.engine_sca.engine_container.src.domain.usecases.handle_remote_config_patterns import (
|
|
5
|
+
HandleRemoteConfigPatterns,
|
|
6
|
+
)
|
|
7
|
+
from devsecops_engine_tools.engine_sca.engine_container.src.domain.usecases.set_input_core import (
|
|
8
|
+
SetInputCore,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def init_engine_sca_rm(
|
|
13
|
+
tool_run,
|
|
14
|
+
tool_remote,
|
|
15
|
+
tool_images,
|
|
16
|
+
tool_deseralizator,
|
|
17
|
+
dict_args,
|
|
18
|
+
token,
|
|
19
|
+
config_tool,
|
|
20
|
+
):
|
|
21
|
+
handle_remote_config_patterns = HandleRemoteConfigPatterns(tool_remote, dict_args)
|
|
22
|
+
flag = handle_remote_config_patterns.ignore_analysis_pattern()
|
|
23
|
+
images_scanned = []
|
|
24
|
+
deseralized = []
|
|
25
|
+
if flag:
|
|
26
|
+
container_sca_scan = ContainerScaScan(
|
|
27
|
+
tool_run,
|
|
28
|
+
tool_remote,
|
|
29
|
+
tool_images,
|
|
30
|
+
tool_deseralizator,
|
|
31
|
+
dict_args,
|
|
32
|
+
token,
|
|
33
|
+
handle_remote_config_patterns.process_handle_skip_tool(),
|
|
34
|
+
)
|
|
35
|
+
images_scanned = container_sca_scan.process()
|
|
36
|
+
deseralized = container_sca_scan.deseralizator(images_scanned)
|
|
37
|
+
input_core = SetInputCore(tool_remote, dict_args, config_tool)
|
|
38
|
+
|
|
39
|
+
return deseralized, input_core.set_input_core(images_scanned
|
|
40
|
+
)
|
|
File without changes
|
devsecops_engine_tools/engine_sca/engine_container/src/infrastructure/helpers/images_scanned.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ImagesScanned:
|
|
5
|
+
@staticmethod
|
|
6
|
+
def get_images_already_scanned(file_name):
|
|
7
|
+
"""
|
|
8
|
+
Create images scanned file if it does not exist and get the images that have already been scanned.
|
|
9
|
+
"""
|
|
10
|
+
scanned_images_file = os.path.join(os.getcwd(), file_name)
|
|
11
|
+
# Check if the file exists; if not, create it
|
|
12
|
+
if not os.path.exists(scanned_images_file):
|
|
13
|
+
open(scanned_images_file, "w").close()
|
|
14
|
+
with open(scanned_images_file, "r") as file:
|
|
15
|
+
images_scanned = file.read().splitlines()
|
|
16
|
+
return images_scanned
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
devsecops_engine_tools/engine_sca/engine_dependencies/src/applications/runner_dependencies_scan.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from devsecops_engine_tools.engine_sca.engine_dependencies.src.infrastructure.driven_adapters.xray_tool.xray_manager_scan import (
|
|
2
|
+
XrayScan,
|
|
3
|
+
)
|
|
4
|
+
from devsecops_engine_tools.engine_sca.engine_dependencies.src.infrastructure.driven_adapters.xray_tool.xray_deserialize_output import (
|
|
5
|
+
XrayDeserializator,
|
|
6
|
+
)
|
|
7
|
+
from devsecops_engine_tools.engine_sca.engine_dependencies.src.infrastructure.entry_points.entry_point_tool import (
|
|
8
|
+
init_engine_dependencies,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def runner_engine_dependencies(dict_args, config_tool, token, devops_platform_gateway):
|
|
13
|
+
try:
|
|
14
|
+
if config_tool["ENGINE_DEPENDENCIES"]["TOOL"] == "XRAY":
|
|
15
|
+
tool_run = XrayScan()
|
|
16
|
+
tool_deserializator = XrayDeserializator()
|
|
17
|
+
|
|
18
|
+
return init_engine_dependencies(
|
|
19
|
+
tool_run,
|
|
20
|
+
devops_platform_gateway,
|
|
21
|
+
tool_deserializator,
|
|
22
|
+
dict_args,
|
|
23
|
+
token,
|
|
24
|
+
config_tool["ENGINE_DEPENDENCIES"]["TOOL"],
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
except Exception as e:
|
|
28
|
+
raise Exception(f"Error SCAN engine dependencies : {str(e)}")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
if __name__ == "__main__":
|
|
32
|
+
runner_engine_dependencies()
|
|
File without changes
|
devsecops_engine_tools/engine_sca/engine_dependencies/src/deployment/infrastructure/__init__.py
ADDED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from abc import ABCMeta, abstractmethod
|
|
2
|
+
from devsecops_engine_tools.engine_core.src.domain.model.finding import Finding
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class DeserializatorGateway(metaclass=ABCMeta):
|
|
6
|
+
@abstractmethod
|
|
7
|
+
def get_list_findings(self, results_scan_file) -> "list[Finding]":
|
|
8
|
+
"Deserializator"
|
|
File without changes
|