cycode 3.0.0rc2__tar.gz → 3.0.1__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-3.0.0rc2 → cycode-3.0.1}/PKG-INFO +1 -1
- cycode-3.0.1/cycode/__init__.py +1 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/app.py +5 -3
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/scan/code_scanner.py +10 -6
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/base_restore_dependencies.py +23 -28
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/go/restore_go_dependencies.py +0 -3
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/maven/restore_gradle_dependencies.py +4 -7
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/maven/restore_maven_dependencies.py +12 -14
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/npm/restore_npm_dependencies.py +0 -3
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/nuget/restore_nuget_dependencies.py +0 -5
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/ruby/restore_ruby_dependencies.py +0 -3
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/sbt/restore_sbt_dependencies.py +0 -3
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/utils/shell_executor.py +6 -2
- {cycode-3.0.0rc2 → cycode-3.0.1}/pyproject.toml +1 -1
- cycode-3.0.0rc2/cycode/__init__.py +0 -1
- {cycode-3.0.0rc2 → cycode-3.0.1}/LICENCE +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/README.md +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/__main__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/ai_remediation/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/ai_remediation/ai_remediation_command.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/ai_remediation/apply_fix.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/ai_remediation/print_remediation.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/auth/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/auth/auth_command.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/auth/auth_common.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/auth/auth_manager.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/auth/models.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/configure/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/configure/configure_command.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/configure/consts.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/configure/messages.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/configure/prompts.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/ignore/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/ignore/ignore_command.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/report/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/report/report_command.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/report/sbom/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/report/sbom/common.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/report/sbom/path/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/report/sbom/path/path_command.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/report/sbom/repository_url/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/report/sbom/repository_url/repository_url_command.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/report/sbom/sbom_command.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/report/sbom/sbom_report_file.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/scan/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/scan/commit_history/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/scan/commit_history/commit_history_command.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/scan/path/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/scan/path/path_command.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/scan/pre_commit/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/scan/pre_commit/pre_commit_command.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/scan/pre_receive/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/scan/pre_receive/pre_receive_command.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/scan/repository/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/scan/repository/repository_command.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/scan/scan_ci/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/scan/scan_ci/ci_integrations.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/scan/scan_ci/scan_ci_command.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/scan/scan_command.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/status/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/status/get_cli_status.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/status/models.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/status/status_command.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/status/version_command.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/cli_types.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/config.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/console.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/consts.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/exceptions/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/exceptions/custom_exceptions.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/exceptions/handle_ai_remediation_errors.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/exceptions/handle_auth_errors.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/exceptions/handle_errors.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/exceptions/handle_report_sbom_errors.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/exceptions/handle_scan_errors.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/excluder.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/iac/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/iac/tf_content_generator.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/models/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/models/in_memory_zip.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/path_documents.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/repository_documents.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/go/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/maven/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/npm/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/nuget/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/ruby/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/sbt/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/sca_code_scanner.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/walk_ignore.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/zip_documents.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/logger.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/main.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/models.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/console_printer.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/json_printer.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/printer_base.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/rich_printer.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/tables/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/tables/sca_table_printer.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/tables/table.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/tables/table_models.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/tables/table_printer.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/tables/table_printer_base.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/text_printer.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/utils/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/utils/code_snippet_syntax.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/utils/detection_data.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/utils/detection_ordering/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/utils/detection_ordering/common_ordering.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/utils/detection_ordering/sca_ordering.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/utils/rich_helpers.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/user_settings/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/user_settings/base_file_manager.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/user_settings/config_file_manager.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/user_settings/configuration_manager.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/user_settings/credentials_manager.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/user_settings/jwt_creator.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/utils/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/utils/enum_utils.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/utils/get_api_client.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/utils/git_proxy.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/utils/ignore_utils.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/utils/jwt_utils.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/utils/path_utils.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/utils/progress_bar.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/utils/scan_batch.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/utils/scan_utils.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/utils/sentry.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/utils/string_utils.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/utils/task_timer.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/utils/version_checker.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/utils/yaml_utils.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/config.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cyclient/__init__.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cyclient/auth_client.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cyclient/client_creator.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cyclient/config.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cyclient/config_dev.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cyclient/cycode_client.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cyclient/cycode_client_base.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cyclient/cycode_dev_based_client.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cyclient/cycode_token_based_client.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cyclient/headers.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cyclient/logger.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cyclient/models.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cyclient/report_client.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cyclient/scan_client.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cyclient/scan_config_base.py +0 -0
- {cycode-3.0.0rc2 → cycode-3.0.1}/cycode/logger.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '3.0.1' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
|
|
@@ -4,6 +4,7 @@ from typing import Annotated, Optional
|
|
|
4
4
|
import typer
|
|
5
5
|
from typer import rich_utils
|
|
6
6
|
from typer._completion_classes import completion_init
|
|
7
|
+
from typer._completion_shared import Shells
|
|
7
8
|
from typer.completion import install_callback, show_callback
|
|
8
9
|
|
|
9
10
|
from cycode import __version__
|
|
@@ -113,16 +114,17 @@ def app_callback(
|
|
|
113
114
|
),
|
|
114
115
|
] = False,
|
|
115
116
|
__: Annotated[
|
|
116
|
-
|
|
117
|
+
Shells, # the choice is required for Homebrew to be able to install the completion
|
|
117
118
|
typer.Option(
|
|
118
119
|
'--show-completion',
|
|
119
120
|
callback=show_callback,
|
|
120
121
|
is_eager=True,
|
|
121
122
|
expose_value=False,
|
|
122
|
-
|
|
123
|
+
show_default=False,
|
|
124
|
+
help='Show completion for the specified shell, to copy it or customize the installation.',
|
|
123
125
|
rich_help_panel=_COMPLETION_RICH_HELP_PANEL,
|
|
124
126
|
),
|
|
125
|
-
] =
|
|
127
|
+
] = None,
|
|
126
128
|
) -> None:
|
|
127
129
|
"""[bold cyan]Cycode CLI - Command Line Interface for Cycode.[/]"""
|
|
128
130
|
init_sentry()
|
|
@@ -683,8 +683,8 @@ def try_get_git_remote_url(path: str) -> Optional[str]:
|
|
|
683
683
|
remote_url = git_proxy.get_repo(path).remotes[0].config_reader.get('url')
|
|
684
684
|
logger.debug('Found Git remote URL, %s', {'remote_url': remote_url, 'path': path})
|
|
685
685
|
return remote_url
|
|
686
|
-
except Exception
|
|
687
|
-
logger.debug('Failed to get Git remote URL'
|
|
686
|
+
except Exception:
|
|
687
|
+
logger.debug('Failed to get Git remote URL. Probably not a Git repository')
|
|
688
688
|
return None
|
|
689
689
|
|
|
690
690
|
|
|
@@ -706,7 +706,9 @@ def _get_plastic_repository_name(path: str) -> Optional[str]:
|
|
|
706
706
|
f'--fieldseparator={consts.PLASTIC_VCS_DATA_SEPARATOR}',
|
|
707
707
|
]
|
|
708
708
|
|
|
709
|
-
status = shell(
|
|
709
|
+
status = shell(
|
|
710
|
+
command=command, timeout=consts.PLASTIC_VSC_CLI_TIMEOUT, working_directory=path, silent_exc_info=True
|
|
711
|
+
)
|
|
710
712
|
if not status:
|
|
711
713
|
logger.debug('Failed to get Plastic repository name (command failed)')
|
|
712
714
|
return None
|
|
@@ -717,8 +719,8 @@ def _get_plastic_repository_name(path: str) -> Optional[str]:
|
|
|
717
719
|
return None
|
|
718
720
|
|
|
719
721
|
return status_parts[2].strip()
|
|
720
|
-
except Exception
|
|
721
|
-
logger.debug('Failed to get Plastic repository name'
|
|
722
|
+
except Exception:
|
|
723
|
+
logger.debug('Failed to get Plastic repository name. Probably not a Plastic repository')
|
|
722
724
|
return None
|
|
723
725
|
|
|
724
726
|
|
|
@@ -738,7 +740,9 @@ def _get_plastic_repository_list(working_dir: Optional[str] = None) -> dict[str,
|
|
|
738
740
|
try:
|
|
739
741
|
command = ['cm', 'repo', 'ls', f'--format={{repname}}{consts.PLASTIC_VCS_DATA_SEPARATOR}{{repguid}}']
|
|
740
742
|
|
|
741
|
-
status = shell(
|
|
743
|
+
status = shell(
|
|
744
|
+
command=command, timeout=consts.PLASTIC_VSC_CLI_TIMEOUT, working_directory=working_dir, silent_exc_info=True
|
|
745
|
+
)
|
|
742
746
|
if not status:
|
|
743
747
|
logger.debug('Failed to get Plastic repository list (command failed)')
|
|
744
748
|
return repo_name_to_guid
|
{cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/base_restore_dependencies.py
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import os
|
|
1
2
|
from abc import ABC, abstractmethod
|
|
2
3
|
from typing import Optional
|
|
3
4
|
|
|
4
5
|
import typer
|
|
5
6
|
|
|
6
|
-
from cycode.cli.logger import logger
|
|
7
7
|
from cycode.cli.models import Document
|
|
8
8
|
from cycode.cli.utils.path_utils import get_file_content, get_file_dir, get_path_from_context, join_paths
|
|
9
9
|
from cycode.cli.utils.shell_executor import shell
|
|
@@ -15,30 +15,27 @@ def build_dep_tree_path(path: str, generated_file_name: str) -> str:
|
|
|
15
15
|
|
|
16
16
|
def execute_commands(
|
|
17
17
|
commands: list[list[str]],
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
dependencies_file_name: Optional[str] = None,
|
|
18
|
+
timeout: int,
|
|
19
|
+
output_file_path: Optional[str] = None,
|
|
21
20
|
working_directory: Optional[str] = None,
|
|
22
21
|
) -> Optional[str]:
|
|
23
22
|
try:
|
|
24
|
-
|
|
23
|
+
outputs = []
|
|
25
24
|
|
|
26
|
-
# Run all commands and collect outputs
|
|
27
25
|
for command in commands:
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
command_output = shell(command=command, timeout=timeout, working_directory=working_directory)
|
|
27
|
+
if command_output:
|
|
28
|
+
outputs.append(command_output)
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
joined_output = '\n'.join(outputs)
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
except Exception as e:
|
|
38
|
-
logger.debug('Failed to restore dependencies via shell command, %s', {'filename': file_name}, exc_info=e)
|
|
32
|
+
if output_file_path:
|
|
33
|
+
with open(output_file_path, 'w', encoding='UTF-8') as output_file:
|
|
34
|
+
output_file.writelines(joined_output)
|
|
35
|
+
except Exception:
|
|
39
36
|
return None
|
|
40
37
|
|
|
41
|
-
return
|
|
38
|
+
return joined_output
|
|
42
39
|
|
|
43
40
|
|
|
44
41
|
class BaseRestoreDependencies(ABC):
|
|
@@ -64,27 +61,25 @@ class BaseRestoreDependencies(ABC):
|
|
|
64
61
|
relative_restore_file_path = build_dep_tree_path(document.path, self.get_lock_file_name())
|
|
65
62
|
working_directory_path = self.get_working_directory(document)
|
|
66
63
|
|
|
67
|
-
if self.verify_restore_file_already_exist(restore_file_path):
|
|
68
|
-
|
|
69
|
-
else:
|
|
70
|
-
output_file_path = restore_file_path if self.create_output_file_manually else None
|
|
71
|
-
execute_commands(
|
|
64
|
+
if not self.verify_restore_file_already_exist(restore_file_path):
|
|
65
|
+
output = execute_commands(
|
|
72
66
|
self.get_commands(manifest_file_path),
|
|
73
|
-
manifest_file_path,
|
|
74
67
|
self.command_timeout,
|
|
75
|
-
output_file_path,
|
|
76
|
-
working_directory_path,
|
|
68
|
+
output_file_path=restore_file_path if self.create_output_file_manually else None,
|
|
69
|
+
working_directory=working_directory_path,
|
|
77
70
|
)
|
|
78
|
-
|
|
71
|
+
if output is None: # one of the commands failed
|
|
72
|
+
return None
|
|
79
73
|
|
|
74
|
+
restore_file_content = get_file_content(restore_file_path)
|
|
80
75
|
return Document(relative_restore_file_path, restore_file_content, self.is_git_diff)
|
|
81
76
|
|
|
82
77
|
def get_working_directory(self, document: Document) -> Optional[str]:
|
|
83
78
|
return None
|
|
84
79
|
|
|
85
|
-
@
|
|
86
|
-
def verify_restore_file_already_exist(
|
|
87
|
-
|
|
80
|
+
@staticmethod
|
|
81
|
+
def verify_restore_file_already_exist(restore_file_path: str) -> bool:
|
|
82
|
+
return os.path.isfile(restore_file_path)
|
|
88
83
|
|
|
89
84
|
@abstractmethod
|
|
90
85
|
def is_project(self, document: Document) -> bool:
|
{cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/go/restore_go_dependencies.py
RENAMED
|
@@ -44,8 +44,5 @@ class RestoreGoDependencies(BaseRestoreDependencies):
|
|
|
44
44
|
def get_lock_file_name(self) -> str:
|
|
45
45
|
return GO_RESTORE_FILE_NAME
|
|
46
46
|
|
|
47
|
-
def verify_restore_file_already_exist(self, restore_file_path: str) -> bool:
|
|
48
|
-
return os.path.isfile(restore_file_path)
|
|
49
|
-
|
|
50
47
|
def get_working_directory(self, document: Document) -> Optional[str]:
|
|
51
48
|
return os.path.dirname(document.absolute_path)
|
{cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/maven/restore_gradle_dependencies.py
RENAMED
|
@@ -42,22 +42,19 @@ class RestoreGradleDependencies(BaseRestoreDependencies):
|
|
|
42
42
|
def get_lock_file_name(self) -> str:
|
|
43
43
|
return BUILD_GRADLE_DEP_TREE_FILE_NAME
|
|
44
44
|
|
|
45
|
-
def verify_restore_file_already_exist(self, restore_file_path: str) -> bool:
|
|
46
|
-
return os.path.isfile(restore_file_path)
|
|
47
|
-
|
|
48
45
|
def get_working_directory(self, document: Document) -> Optional[str]:
|
|
49
46
|
return get_path_from_context(self.ctx) if self.is_gradle_sub_projects() else None
|
|
50
47
|
|
|
51
48
|
def get_all_projects(self) -> set[str]:
|
|
52
|
-
|
|
49
|
+
output = shell(
|
|
53
50
|
command=BUILD_GRADLE_ALL_PROJECTS_COMMAND,
|
|
54
51
|
timeout=BUILD_GRADLE_ALL_PROJECTS_TIMEOUT,
|
|
55
52
|
working_directory=get_path_from_context(self.ctx),
|
|
56
53
|
)
|
|
54
|
+
if not output:
|
|
55
|
+
return set()
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return set(projects)
|
|
57
|
+
return set(re.findall(ALL_PROJECTS_REGEX, output))
|
|
61
58
|
|
|
62
59
|
def get_commands_for_sub_projects(self, manifest_file_path: str) -> list[list[str]]:
|
|
63
60
|
project_name = os.path.basename(os.path.dirname(manifest_file_path))
|
{cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/maven/restore_maven_dependencies.py
RENAMED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import os
|
|
2
1
|
from os import path
|
|
3
2
|
from typing import Optional
|
|
4
3
|
|
|
@@ -30,9 +29,6 @@ class RestoreMavenDependencies(BaseRestoreDependencies):
|
|
|
30
29
|
def get_lock_file_name(self) -> str:
|
|
31
30
|
return join_paths('target', MAVEN_CYCLONE_DEP_TREE_FILE_NAME)
|
|
32
31
|
|
|
33
|
-
def verify_restore_file_already_exist(self, restore_file_path: str) -> bool:
|
|
34
|
-
return os.path.isfile(restore_file_path)
|
|
35
|
-
|
|
36
32
|
def try_restore_dependencies(self, document: Document) -> Optional[Document]:
|
|
37
33
|
restore_dependencies_document = super().try_restore_dependencies(document)
|
|
38
34
|
manifest_file_path = self.get_manifest_file_path(document)
|
|
@@ -51,8 +47,8 @@ class RestoreMavenDependencies(BaseRestoreDependencies):
|
|
|
51
47
|
self, document: Document, manifest_file_path: str, restore_dependencies_document: Optional[Document]
|
|
52
48
|
) -> Optional[Document]:
|
|
53
49
|
# TODO(MarshalX): does it even work? Ignored restore_dependencies_document arg
|
|
54
|
-
secondary_restore_command =
|
|
55
|
-
backup_restore_content = execute_commands(secondary_restore_command,
|
|
50
|
+
secondary_restore_command = create_secondary_restore_commands(manifest_file_path)
|
|
51
|
+
backup_restore_content = execute_commands(secondary_restore_command, self.command_timeout)
|
|
56
52
|
restore_dependencies_document = Document(
|
|
57
53
|
build_dep_tree_path(document.path, MAVEN_DEP_TREE_FILE_NAME), backup_restore_content, self.is_git_diff
|
|
58
54
|
)
|
|
@@ -64,13 +60,15 @@ class RestoreMavenDependencies(BaseRestoreDependencies):
|
|
|
64
60
|
return restore_dependencies
|
|
65
61
|
|
|
66
62
|
|
|
67
|
-
def
|
|
63
|
+
def create_secondary_restore_commands(manifest_file_path: str) -> list[list[str]]:
|
|
68
64
|
return [
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
[
|
|
66
|
+
'mvn',
|
|
67
|
+
'dependency:tree',
|
|
68
|
+
'-B',
|
|
69
|
+
'-DoutputType=text',
|
|
70
|
+
'-f',
|
|
71
|
+
manifest_file_path,
|
|
72
|
+
f'-DoutputFile={MAVEN_DEP_TREE_FILE_NAME}',
|
|
73
|
+
]
|
|
76
74
|
]
|
{cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/npm/restore_npm_dependencies.py
RENAMED
|
@@ -33,9 +33,6 @@ class RestoreNpmDependencies(BaseRestoreDependencies):
|
|
|
33
33
|
def get_lock_file_name(self) -> str:
|
|
34
34
|
return NPM_LOCK_FILE_NAME
|
|
35
35
|
|
|
36
|
-
def verify_restore_file_already_exist(self, restore_file_path: str) -> bool:
|
|
37
|
-
return os.path.isfile(restore_file_path)
|
|
38
|
-
|
|
39
36
|
@staticmethod
|
|
40
37
|
def prepare_manifest_file_path_for_command(manifest_file_path: str) -> str:
|
|
41
38
|
return manifest_file_path.replace(os.sep + NPM_MANIFEST_FILE_NAME, '')
|
{cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/nuget/restore_nuget_dependencies.py
RENAMED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
1
|
import typer
|
|
4
2
|
|
|
5
3
|
from cycode.cli.files_collector.sca.base_restore_dependencies import BaseRestoreDependencies
|
|
@@ -21,6 +19,3 @@ class RestoreNugetDependencies(BaseRestoreDependencies):
|
|
|
21
19
|
|
|
22
20
|
def get_lock_file_name(self) -> str:
|
|
23
21
|
return NUGET_LOCK_FILE_NAME
|
|
24
|
-
|
|
25
|
-
def verify_restore_file_already_exist(self, restore_file_path: str) -> bool:
|
|
26
|
-
return os.path.isfile(restore_file_path)
|
{cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/ruby/restore_ruby_dependencies.py
RENAMED
|
@@ -18,8 +18,5 @@ class RestoreRubyDependencies(BaseRestoreDependencies):
|
|
|
18
18
|
def get_lock_file_name(self) -> str:
|
|
19
19
|
return RUBY_LOCK_FILE_NAME
|
|
20
20
|
|
|
21
|
-
def verify_restore_file_already_exist(self, restore_file_path: str) -> bool:
|
|
22
|
-
return os.path.isfile(restore_file_path)
|
|
23
|
-
|
|
24
21
|
def get_working_directory(self, document: Document) -> Optional[str]:
|
|
25
22
|
return os.path.dirname(document.absolute_path)
|
{cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/files_collector/sca/sbt/restore_sbt_dependencies.py
RENAMED
|
@@ -18,8 +18,5 @@ class RestoreSbtDependencies(BaseRestoreDependencies):
|
|
|
18
18
|
def get_lock_file_name(self) -> str:
|
|
19
19
|
return SBT_LOCK_FILE_NAME
|
|
20
20
|
|
|
21
|
-
def verify_restore_file_already_exist(self, restore_file_path: str) -> bool:
|
|
22
|
-
return os.path.isfile(restore_file_path)
|
|
23
|
-
|
|
24
21
|
def get_working_directory(self, document: Document) -> Optional[str]:
|
|
25
22
|
return os.path.dirname(document.absolute_path)
|
|
@@ -16,6 +16,7 @@ def shell(
|
|
|
16
16
|
command: Union[str, list[str]],
|
|
17
17
|
timeout: int = _SUBPROCESS_DEFAULT_TIMEOUT_SEC,
|
|
18
18
|
working_directory: Optional[str] = None,
|
|
19
|
+
silent_exc_info: bool = False,
|
|
19
20
|
) -> Optional[str]:
|
|
20
21
|
logger.debug('Executing shell command: %s', command)
|
|
21
22
|
|
|
@@ -27,12 +28,15 @@ def shell(
|
|
|
27
28
|
|
|
28
29
|
return result.stdout.decode('UTF-8').strip()
|
|
29
30
|
except subprocess.CalledProcessError as e:
|
|
30
|
-
|
|
31
|
+
if not silent_exc_info:
|
|
32
|
+
logger.debug('Error occurred while running shell command', exc_info=e)
|
|
31
33
|
except subprocess.TimeoutExpired as e:
|
|
32
34
|
logger.debug('Command timed out', exc_info=e)
|
|
33
35
|
raise typer.Abort(f'Command "{command}" timed out') from e
|
|
34
36
|
except Exception as e:
|
|
35
|
-
|
|
37
|
+
if not silent_exc_info:
|
|
38
|
+
logger.debug('Unhandled exception occurred while running shell command', exc_info=e)
|
|
39
|
+
|
|
36
40
|
raise click.ClickException(f'Unhandled exception: {e}') from e
|
|
37
41
|
|
|
38
42
|
return None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "cycode"
|
|
3
|
-
version = "3.0.
|
|
3
|
+
version = "3.0.1" # 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__ = '3.0.0.rc2' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
|
|
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
|
|
File without changes
|
|
File without changes
|
{cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/apps/scan/commit_history/commit_history_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
|
|
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
|
|
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
|
{cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/utils/detection_ordering/common_ordering.py
RENAMED
|
File without changes
|
{cycode-3.0.0rc2 → cycode-3.0.1}/cycode/cli/printers/utils/detection_ordering/sca_ordering.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
|
|
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
|