cycode 1.11.1.dev11__tar.gz → 1.11.1.dev13__tar.gz
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.
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/PKG-INFO +1 -1
- cycode-1.11.1.dev13/cycode/__init__.py +1 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/path_documents.py +1 -1
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/sca/base_restore_dependencies.py +17 -9
- cycode-1.11.1.dev13/cycode/cli/files_collector/sca/go/restore_go_dependencies.py +51 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/sca/maven/restore_gradle_dependencies.py +2 -2
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/sca/maven/restore_maven_dependencies.py +4 -4
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/sca/npm/restore_npm_dependencies.py +10 -8
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/sca/nuget/restore_nuget_dependencies.py +2 -2
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/sca/sbt/restore_sbt_dependencies.py +2 -2
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/sca/sca_code_scanner.py +6 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/pyproject.toml +1 -1
- cycode-1.11.1.dev11/cycode/__init__.py +0 -1
- cycode-1.11.1.dev11/cycode/cli/files_collector/sca/go/restore_go_dependencies.py +0 -31
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/LICENCE +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/README.md +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/auth/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/auth/auth_command.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/auth/auth_manager.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/configure/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/configure/configure_command.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/ignore/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/ignore/ignore_command.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/main_cli.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/report/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/report/report_command.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/report/sbom/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/report/sbom/common.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/report/sbom/path/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/report/sbom/path/path_command.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/report/sbom/repository_url/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/report/sbom/repository_url/repository_url_command.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/report/sbom/sbom_command.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/report/sbom/sbom_report_file.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/code_scanner.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/commit_history/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/commit_history/commit_history_command.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/path/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/path/path_command.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/pre_commit/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/pre_commit/pre_commit_command.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/pre_receive/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/pre_receive/pre_receive_command.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/repository/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/repository/repository_command.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/scan_ci/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/scan_ci/ci_integrations.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/scan_ci/scan_ci_command.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/scan_command.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/version/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/version/version_command.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/config.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/config.yaml +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/consts.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/exceptions/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/exceptions/custom_exceptions.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/exceptions/handle_report_sbom_errors.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/exceptions/handle_scan_errors.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/excluder.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/iac/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/iac/tf_content_generator.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/models/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/models/in_memory_zip.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/repository_documents.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/sca/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/sca/go/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/sca/maven/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/sca/npm/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/sca/nuget/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/sca/sbt/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/zip_documents.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/main.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/models.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/printers/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/printers/console_printer.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/printers/json_printer.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/printers/printer_base.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/printers/tables/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/printers/tables/sca_table_printer.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/printers/tables/table.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/printers/tables/table_models.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/printers/tables/table_printer.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/printers/tables/table_printer_base.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/printers/text_printer.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/sentry.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/user_settings/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/user_settings/base_file_manager.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/user_settings/config_file_manager.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/user_settings/configuration_manager.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/user_settings/credentials_manager.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/user_settings/jwt_creator.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/utils/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/utils/enum_utils.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/utils/get_api_client.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/utils/git_proxy.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/utils/jwt_utils.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/utils/path_utils.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/utils/progress_bar.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/utils/scan_batch.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/utils/scan_utils.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/utils/shell_executor.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/utils/string_utils.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/utils/task_timer.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/utils/yaml_utils.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cyclient/__init__.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cyclient/auth_client.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cyclient/client_creator.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cyclient/config.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cyclient/config.yaml +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cyclient/config_dev.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cyclient/cycode_client.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cyclient/cycode_client_base.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cyclient/cycode_dev_based_client.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cyclient/cycode_token_based_client.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cyclient/headers.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cyclient/models.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cyclient/report_client.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cyclient/scan_client.py +0 -0
- {cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cyclient/scan_config_base.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '1.11.1.dev13' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
|
|
@@ -84,7 +84,7 @@ def _generate_document(file: str, scan_type: str, content: str, is_git_diff: boo
|
|
|
84
84
|
if is_iac(scan_type) and is_tfplan_file(file, content):
|
|
85
85
|
return _handle_tfplan_file(file, content, is_git_diff)
|
|
86
86
|
|
|
87
|
-
return Document(file, content, is_git_diff)
|
|
87
|
+
return Document(file, content, is_git_diff, absolute_path=file)
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
def _handle_tfplan_file(file: str, content: str, is_git_diff: bool) -> Document:
|
|
@@ -13,19 +13,27 @@ def build_dep_tree_path(path: str, generated_file_name: str) -> str:
|
|
|
13
13
|
return join_paths(get_file_dir(path), generated_file_name)
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
def
|
|
17
|
-
|
|
16
|
+
def execute_commands(
|
|
17
|
+
commands: List[List[str]],
|
|
18
18
|
file_name: str,
|
|
19
19
|
command_timeout: int,
|
|
20
20
|
dependencies_file_name: Optional[str] = None,
|
|
21
21
|
working_directory: Optional[str] = None,
|
|
22
22
|
) -> Optional[str]:
|
|
23
23
|
try:
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
all_dependencies = []
|
|
25
|
+
|
|
26
|
+
# Run all commands and collect outputs
|
|
27
|
+
for command in commands:
|
|
28
|
+
dependencies = shell(command=command, timeout=command_timeout, working_directory=working_directory)
|
|
29
|
+
all_dependencies.append(dependencies) # Collect each command's output
|
|
30
|
+
|
|
31
|
+
dependencies = '\n'.join(all_dependencies)
|
|
32
|
+
|
|
33
|
+
# Write all collected outputs to the file if dependencies_file_name is provided
|
|
26
34
|
if dependencies_file_name:
|
|
27
|
-
with open(dependencies_file_name, 'w') as output_file:
|
|
28
|
-
output_file.
|
|
35
|
+
with open(dependencies_file_name, 'w') as output_file: # Open once in 'w' mode to start fresh
|
|
36
|
+
output_file.writelines(dependencies)
|
|
29
37
|
except Exception as e:
|
|
30
38
|
logger.debug('Failed to restore dependencies via shell command, %s', {'filename': file_name}, exc_info=e)
|
|
31
39
|
return None
|
|
@@ -62,8 +70,8 @@ class BaseRestoreDependencies(ABC):
|
|
|
62
70
|
restore_file_content = get_file_content(restore_file_path)
|
|
63
71
|
else:
|
|
64
72
|
output_file_path = restore_file_path if self.create_output_file_manually else None
|
|
65
|
-
|
|
66
|
-
self.
|
|
73
|
+
execute_commands(
|
|
74
|
+
self.get_commands(manifest_file_path),
|
|
67
75
|
manifest_file_path,
|
|
68
76
|
self.command_timeout,
|
|
69
77
|
output_file_path,
|
|
@@ -85,7 +93,7 @@ class BaseRestoreDependencies(ABC):
|
|
|
85
93
|
pass
|
|
86
94
|
|
|
87
95
|
@abstractmethod
|
|
88
|
-
def
|
|
96
|
+
def get_commands(self, manifest_file_path: str) -> List[List[str]]:
|
|
89
97
|
pass
|
|
90
98
|
|
|
91
99
|
@abstractmethod
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import os
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
|
|
5
|
+
import click
|
|
6
|
+
|
|
7
|
+
from cycode.cli.files_collector.sca.base_restore_dependencies import BaseRestoreDependencies
|
|
8
|
+
from cycode.cli.models import Document
|
|
9
|
+
|
|
10
|
+
GO_PROJECT_FILE_EXTENSIONS = ['.mod', '.sum']
|
|
11
|
+
GO_RESTORE_FILE_NAME = 'go.mod.graph'
|
|
12
|
+
BUILD_GO_FILE_NAME = 'go.mod'
|
|
13
|
+
BUILD_GO_LOCK_FILE_NAME = 'go.sum'
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class RestoreGoDependencies(BaseRestoreDependencies):
|
|
17
|
+
def __init__(self, context: click.Context, is_git_diff: bool, command_timeout: int) -> None:
|
|
18
|
+
super().__init__(context, is_git_diff, command_timeout, create_output_file_manually=True)
|
|
19
|
+
|
|
20
|
+
def try_restore_dependencies(self, document: Document) -> Optional[Document]:
|
|
21
|
+
manifest_exists = os.path.isfile(self.get_working_directory(document) + os.sep + BUILD_GO_FILE_NAME)
|
|
22
|
+
lock_exists = os.path.isfile(self.get_working_directory(document) + os.sep + BUILD_GO_LOCK_FILE_NAME)
|
|
23
|
+
|
|
24
|
+
if not manifest_exists or not lock_exists:
|
|
25
|
+
logging.info('No manifest go.mod file found' if not manifest_exists else 'No manifest go.sum file found')
|
|
26
|
+
|
|
27
|
+
manifest_files_exists = manifest_exists & lock_exists
|
|
28
|
+
|
|
29
|
+
if not manifest_files_exists:
|
|
30
|
+
return None
|
|
31
|
+
|
|
32
|
+
return super().try_restore_dependencies(document)
|
|
33
|
+
|
|
34
|
+
def is_project(self, document: Document) -> bool:
|
|
35
|
+
return any(document.path.endswith(ext) for ext in GO_PROJECT_FILE_EXTENSIONS)
|
|
36
|
+
|
|
37
|
+
def get_commands(self, manifest_file_path: str) -> List[List[str]]:
|
|
38
|
+
return [
|
|
39
|
+
['go', 'list', '-m', '-json', 'all'],
|
|
40
|
+
['echo', '------------------------------------------------------'],
|
|
41
|
+
['go', 'mod', 'graph'],
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
def get_lock_file_name(self) -> str:
|
|
45
|
+
return GO_RESTORE_FILE_NAME
|
|
46
|
+
|
|
47
|
+
def verify_restore_file_already_exist(self, restore_file_path: str) -> bool:
|
|
48
|
+
return os.path.isfile(restore_file_path)
|
|
49
|
+
|
|
50
|
+
def get_working_directory(self, document: Document) -> Optional[str]:
|
|
51
|
+
return os.path.dirname(document.absolute_path)
|
|
@@ -18,8 +18,8 @@ class RestoreGradleDependencies(BaseRestoreDependencies):
|
|
|
18
18
|
def is_project(self, document: Document) -> bool:
|
|
19
19
|
return document.path.endswith(BUILD_GRADLE_FILE_NAME) or document.path.endswith(BUILD_GRADLE_KTS_FILE_NAME)
|
|
20
20
|
|
|
21
|
-
def
|
|
22
|
-
return ['gradle', 'dependencies', '-b', manifest_file_path, '-q', '--console', 'plain']
|
|
21
|
+
def get_commands(self, manifest_file_path: str) -> List[List[str]]:
|
|
22
|
+
return [['gradle', 'dependencies', '-b', manifest_file_path, '-q', '--console', 'plain']]
|
|
23
23
|
|
|
24
24
|
def get_lock_file_name(self) -> str:
|
|
25
25
|
return BUILD_GRADLE_DEP_TREE_FILE_NAME
|
|
@@ -7,7 +7,7 @@ import click
|
|
|
7
7
|
from cycode.cli.files_collector.sca.base_restore_dependencies import (
|
|
8
8
|
BaseRestoreDependencies,
|
|
9
9
|
build_dep_tree_path,
|
|
10
|
-
|
|
10
|
+
execute_commands,
|
|
11
11
|
)
|
|
12
12
|
from cycode.cli.models import Document
|
|
13
13
|
from cycode.cli.utils.path_utils import get_file_content, get_file_dir, join_paths
|
|
@@ -24,8 +24,8 @@ class RestoreMavenDependencies(BaseRestoreDependencies):
|
|
|
24
24
|
def is_project(self, document: Document) -> bool:
|
|
25
25
|
return path.basename(document.path).split('/')[-1] == BUILD_MAVEN_FILE_NAME
|
|
26
26
|
|
|
27
|
-
def
|
|
28
|
-
return ['mvn', 'org.cyclonedx:cyclonedx-maven-plugin:2.7.4:makeAggregateBom', '-f', manifest_file_path]
|
|
27
|
+
def get_commands(self, manifest_file_path: str) -> List[List[str]]:
|
|
28
|
+
return [['mvn', 'org.cyclonedx:cyclonedx-maven-plugin:2.7.4:makeAggregateBom', '-f', manifest_file_path]]
|
|
29
29
|
|
|
30
30
|
def get_lock_file_name(self) -> str:
|
|
31
31
|
return join_paths('target', MAVEN_CYCLONE_DEP_TREE_FILE_NAME)
|
|
@@ -52,7 +52,7 @@ class RestoreMavenDependencies(BaseRestoreDependencies):
|
|
|
52
52
|
) -> Optional[Document]:
|
|
53
53
|
# TODO(MarshalX): does it even work? Ignored restore_dependencies_document arg
|
|
54
54
|
secondary_restore_command = create_secondary_restore_command(manifest_file_path)
|
|
55
|
-
backup_restore_content =
|
|
55
|
+
backup_restore_content = execute_commands(secondary_restore_command, manifest_file_path, self.command_timeout)
|
|
56
56
|
restore_dependencies_document = Document(
|
|
57
57
|
build_dep_tree_path(document.path, MAVEN_DEP_TREE_FILE_NAME), backup_restore_content, self.is_git_diff
|
|
58
58
|
)
|
|
@@ -18,15 +18,17 @@ class RestoreNpmDependencies(BaseRestoreDependencies):
|
|
|
18
18
|
def is_project(self, document: Document) -> bool:
|
|
19
19
|
return any(document.path.endswith(ext) for ext in NPM_PROJECT_FILE_EXTENSIONS)
|
|
20
20
|
|
|
21
|
-
def
|
|
21
|
+
def get_commands(self, manifest_file_path: str) -> List[List[str]]:
|
|
22
22
|
return [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
[
|
|
24
|
+
'npm',
|
|
25
|
+
'install',
|
|
26
|
+
'--prefix',
|
|
27
|
+
self.prepare_manifest_file_path_for_command(manifest_file_path),
|
|
28
|
+
'--package-lock-only',
|
|
29
|
+
'--ignore-scripts',
|
|
30
|
+
'--no-audit',
|
|
31
|
+
]
|
|
30
32
|
]
|
|
31
33
|
|
|
32
34
|
def get_lock_file_name(self) -> str:
|
|
@@ -17,8 +17,8 @@ class RestoreNugetDependencies(BaseRestoreDependencies):
|
|
|
17
17
|
def is_project(self, document: Document) -> bool:
|
|
18
18
|
return any(document.path.endswith(ext) for ext in NUGET_PROJECT_FILE_EXTENSIONS)
|
|
19
19
|
|
|
20
|
-
def
|
|
21
|
-
return ['dotnet', 'restore', manifest_file_path, '--use-lock-file', '--verbosity', 'quiet']
|
|
20
|
+
def get_commands(self, manifest_file_path: str) -> List[List[str]]:
|
|
21
|
+
return [['dotnet', 'restore', manifest_file_path, '--use-lock-file', '--verbosity', 'quiet']]
|
|
22
22
|
|
|
23
23
|
def get_lock_file_name(self) -> str:
|
|
24
24
|
return NUGET_LOCK_FILE_NAME
|
|
@@ -12,8 +12,8 @@ class RestoreSbtDependencies(BaseRestoreDependencies):
|
|
|
12
12
|
def is_project(self, document: Document) -> bool:
|
|
13
13
|
return any(document.path.endswith(ext) for ext in SBT_PROJECT_FILE_EXTENSIONS)
|
|
14
14
|
|
|
15
|
-
def
|
|
16
|
-
return ['sbt', 'dependencyLockWrite', '--verbose']
|
|
15
|
+
def get_commands(self, manifest_file_path: str) -> List[List[str]]:
|
|
16
|
+
return [['sbt', 'dependencyLockWrite', '--verbose']]
|
|
17
17
|
|
|
18
18
|
def get_lock_file_name(self) -> str:
|
|
19
19
|
return SBT_LOCK_FILE_NAME
|
{cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/sca/sca_code_scanner.py
RENAMED
|
@@ -5,8 +5,11 @@ import click
|
|
|
5
5
|
|
|
6
6
|
from cycode.cli import consts
|
|
7
7
|
from cycode.cli.files_collector.sca.base_restore_dependencies import BaseRestoreDependencies
|
|
8
|
+
from cycode.cli.files_collector.sca.go.restore_go_dependencies import RestoreGoDependencies
|
|
8
9
|
from cycode.cli.files_collector.sca.maven.restore_gradle_dependencies import RestoreGradleDependencies
|
|
9
10
|
from cycode.cli.files_collector.sca.maven.restore_maven_dependencies import RestoreMavenDependencies
|
|
11
|
+
from cycode.cli.files_collector.sca.npm.restore_npm_dependencies import RestoreNpmDependencies
|
|
12
|
+
from cycode.cli.files_collector.sca.nuget.restore_nuget_dependencies import RestoreNugetDependencies
|
|
10
13
|
from cycode.cli.files_collector.sca.sbt.restore_sbt_dependencies import RestoreSbtDependencies
|
|
11
14
|
from cycode.cli.models import Document
|
|
12
15
|
from cycode.cli.utils.git_proxy import git_proxy
|
|
@@ -132,6 +135,9 @@ def restore_handlers(context: click.Context, is_git_diff: bool) -> List[BaseRest
|
|
|
132
135
|
RestoreGradleDependencies(context, is_git_diff, BUILD_DEP_TREE_TIMEOUT),
|
|
133
136
|
RestoreMavenDependencies(context, is_git_diff, BUILD_DEP_TREE_TIMEOUT),
|
|
134
137
|
RestoreSbtDependencies(context, is_git_diff, BUILD_DEP_TREE_TIMEOUT),
|
|
138
|
+
RestoreGoDependencies(context, is_git_diff, BUILD_DEP_TREE_TIMEOUT),
|
|
139
|
+
RestoreNugetDependencies(context, is_git_diff, BUILD_DEP_TREE_TIMEOUT),
|
|
140
|
+
RestoreNpmDependencies(context, is_git_diff, BUILD_DEP_TREE_TIMEOUT),
|
|
135
141
|
]
|
|
136
142
|
|
|
137
143
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "cycode"
|
|
3
|
-
version = "1.11.1.
|
|
3
|
+
version = "1.11.1.dev13" # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
|
|
4
4
|
description = "Boost security in your dev lifecycle via SAST, SCA, Secrets & IaC scanning."
|
|
5
5
|
keywords=["secret-scan", "cycode", "devops", "token", "secret", "security", "cycode", "code"]
|
|
6
6
|
authors = ["Cycode <support@cycode.com>"]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '1.11.1.dev11' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from typing import List
|
|
3
|
-
|
|
4
|
-
import click
|
|
5
|
-
|
|
6
|
-
from cycode.cli.files_collector.sca.base_restore_dependencies import BaseRestoreDependencies
|
|
7
|
-
from cycode.cli.models import Document
|
|
8
|
-
|
|
9
|
-
GO_PROJECT_FILE_EXTENSIONS = ['.mod']
|
|
10
|
-
GO_RESTORE_FILE_NAME = 'go.sum'
|
|
11
|
-
BUILD_GO_FILE_NAME = 'go.mod'
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class RestoreGoDependencies(BaseRestoreDependencies):
|
|
15
|
-
def __init__(self, context: click.Context, is_git_diff: bool, command_timeout: int) -> None:
|
|
16
|
-
super().__init__(context, is_git_diff, command_timeout, create_output_file_manually=True)
|
|
17
|
-
|
|
18
|
-
def is_project(self, document: Document) -> bool:
|
|
19
|
-
return any(document.path.endswith(ext) for ext in GO_PROJECT_FILE_EXTENSIONS)
|
|
20
|
-
|
|
21
|
-
def get_command(self, manifest_file_path: str) -> List[str]:
|
|
22
|
-
return ['cd', self.prepare_tree_file_path_for_command(manifest_file_path), '&&', 'go', 'list', '-m', '-json']
|
|
23
|
-
|
|
24
|
-
def get_lock_file_name(self) -> str:
|
|
25
|
-
return GO_RESTORE_FILE_NAME
|
|
26
|
-
|
|
27
|
-
def verify_restore_file_already_exist(self, restore_file_path: str) -> bool:
|
|
28
|
-
return os.path.isfile(restore_file_path)
|
|
29
|
-
|
|
30
|
-
def prepare_tree_file_path_for_command(self, manifest_file_path: str) -> str:
|
|
31
|
-
return manifest_file_path.replace(os.sep + BUILD_GO_FILE_NAME, '')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/configure/configure_command.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/report/sbom/path/__init__.py
RENAMED
|
File without changes
|
{cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/report/sbom/path/path_command.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/report/sbom/sbom_report_file.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/commit_history/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/pre_receive/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/scan_ci/ci_integrations.py
RENAMED
|
File without changes
|
{cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/commands/scan/scan_ci/scan_ci_command.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/exceptions/handle_report_sbom_errors.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/iac/tf_content_generator.py
RENAMED
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/models/in_memory_zip.py
RENAMED
|
File without changes
|
{cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/repository_documents.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/sca/maven/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/files_collector/sca/nuget/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/printers/tables/table_printer_base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev11 → cycode-1.11.1.dev13}/cycode/cli/user_settings/configuration_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|