cycode 2.1.2.dev1__tar.gz → 2.2.1.dev1__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-2.1.2.dev1 → cycode-2.2.1.dev1}/PKG-INFO +1 -1
- cycode-2.2.1.dev1/cycode/__init__.py +1 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/ignore/ignore_command.py +53 -23
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/main_cli.py +31 -1
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/code_scanner.py +37 -27
- cycode-2.2.1.dev1/cycode/cli/commands/version/version_checker.py +209 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/consts.py +1 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/walk_ignore.py +2 -1
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/user_settings/configuration_manager.py +2 -1
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/utils/ignore_utils.py +2 -4
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/utils/path_utils.py +5 -2
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/pyproject.toml +1 -1
- cycode-2.1.2.dev1/cycode/__init__.py +0 -1
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/LICENCE +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/README.md +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/ai_remediation/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/ai_remediation/ai_remediation_command.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/auth/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/auth/auth_command.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/auth/auth_manager.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/auth_common.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/configure/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/configure/configure_command.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/ignore/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/report/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/report/report_command.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/report/sbom/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/report/sbom/common.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/report/sbom/path/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/report/sbom/path/path_command.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/report/sbom/repository_url/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/report/sbom/repository_url/repository_url_command.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/report/sbom/sbom_command.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/report/sbom/sbom_report_file.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/commit_history/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/commit_history/commit_history_command.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/path/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/path/path_command.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/pre_commit/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/pre_commit/pre_commit_command.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/pre_receive/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/pre_receive/pre_receive_command.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/repository/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/repository/repository_command.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/scan_ci/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/scan_ci/ci_integrations.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/scan_ci/scan_ci_command.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/scan_command.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/status/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/status/status_command.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/version/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/version/version_command.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/config.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/config.yaml +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/exceptions/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/exceptions/common.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/exceptions/custom_exceptions.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/exceptions/handle_ai_remediation_errors.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/exceptions/handle_report_sbom_errors.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/exceptions/handle_scan_errors.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/excluder.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/iac/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/iac/tf_content_generator.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/models/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/models/in_memory_zip.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/path_documents.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/repository_documents.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/sca/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/sca/base_restore_dependencies.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/sca/go/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/sca/go/restore_go_dependencies.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/sca/maven/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/sca/maven/restore_gradle_dependencies.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/sca/maven/restore_maven_dependencies.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/sca/npm/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/sca/npm/restore_npm_dependencies.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/sca/nuget/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/sca/nuget/restore_nuget_dependencies.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/sca/ruby/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/sca/ruby/restore_ruby_dependencies.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/sca/sbt/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/sca/sbt/restore_sbt_dependencies.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/sca/sca_code_scanner.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/zip_documents.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/main.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/models.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/printers/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/printers/console_printer.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/printers/json_printer.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/printers/printer_base.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/printers/tables/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/printers/tables/sca_table_printer.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/printers/tables/table.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/printers/tables/table_models.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/printers/tables/table_printer.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/printers/tables/table_printer_base.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/printers/text_printer.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/sentry.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/user_settings/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/user_settings/base_file_manager.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/user_settings/config_file_manager.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/user_settings/credentials_manager.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/user_settings/jwt_creator.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/utils/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/utils/enum_utils.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/utils/get_api_client.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/utils/git_proxy.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/utils/jwt_utils.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/utils/progress_bar.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/utils/scan_batch.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/utils/scan_utils.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/utils/shell_executor.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/utils/string_utils.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/utils/task_timer.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/utils/yaml_utils.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cyclient/__init__.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cyclient/auth_client.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cyclient/client_creator.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cyclient/config.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cyclient/config.yaml +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cyclient/config_dev.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cyclient/cycode_client.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cyclient/cycode_client_base.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cyclient/cycode_dev_based_client.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cyclient/cycode_token_based_client.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cyclient/headers.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cyclient/models.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cyclient/report_client.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cyclient/scan_client.py +0 -0
- {cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cyclient/scan_config_base.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '2.2.1.dev1' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import os
|
|
2
1
|
import re
|
|
2
|
+
from typing import Optional
|
|
3
3
|
|
|
4
4
|
import click
|
|
5
5
|
|
|
6
6
|
from cycode.cli import consts
|
|
7
7
|
from cycode.cli.config import config, configuration_manager
|
|
8
8
|
from cycode.cli.sentry import add_breadcrumb
|
|
9
|
-
from cycode.cli.utils.path_utils import get_absolute_path
|
|
9
|
+
from cycode.cli.utils.path_utils import get_absolute_path, is_path_exists
|
|
10
10
|
from cycode.cli.utils.string_utils import hash_string_to_sha256
|
|
11
11
|
from cycode.cyclient import logger
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
def _is_path_to_ignore_exists(path: str) -> bool:
|
|
15
|
-
return os.path.exists(path)
|
|
16
|
-
|
|
17
|
-
|
|
18
14
|
def _is_package_pattern_valid(package: str) -> bool:
|
|
19
15
|
return re.search('^[^@]+@[^@]+$', package) is not None
|
|
20
16
|
|
|
@@ -47,10 +43,16 @@ def _is_package_pattern_valid(package: str) -> bool:
|
|
|
47
43
|
required=False,
|
|
48
44
|
help='Ignore scanning a specific package version while running an SCA scan. Expected pattern: name@version.',
|
|
49
45
|
)
|
|
46
|
+
@click.option(
|
|
47
|
+
'--by-cve',
|
|
48
|
+
type=click.STRING,
|
|
49
|
+
required=False,
|
|
50
|
+
help='Ignore scanning a specific CVE while running an SCA scan. Expected pattern: CVE-YYYY-NNN.',
|
|
51
|
+
)
|
|
50
52
|
@click.option(
|
|
51
53
|
'--scan-type',
|
|
52
54
|
'-t',
|
|
53
|
-
default=
|
|
55
|
+
default=consts.SECRET_SCAN_TYPE,
|
|
54
56
|
help='Specify the type of scan you wish to execute (the default is Secrets).',
|
|
55
57
|
type=click.Choice(config['scans']['supported_scans']),
|
|
56
58
|
required=False,
|
|
@@ -64,40 +66,68 @@ def _is_package_pattern_valid(package: str) -> bool:
|
|
|
64
66
|
required=False,
|
|
65
67
|
help='Add an ignore rule to the global CLI config.',
|
|
66
68
|
)
|
|
67
|
-
def ignore_command(
|
|
68
|
-
by_value: str,
|
|
69
|
+
def ignore_command( # noqa: C901
|
|
70
|
+
by_value: Optional[str],
|
|
71
|
+
by_sha: Optional[str],
|
|
72
|
+
by_path: Optional[str],
|
|
73
|
+
by_rule: Optional[str],
|
|
74
|
+
by_package: Optional[str],
|
|
75
|
+
by_cve: Optional[str],
|
|
76
|
+
scan_type: str = consts.SECRET_SCAN_TYPE,
|
|
77
|
+
is_global: bool = False,
|
|
69
78
|
) -> None:
|
|
70
79
|
"""Ignores a specific value, path or rule ID."""
|
|
71
80
|
add_breadcrumb('ignore')
|
|
72
81
|
|
|
73
|
-
|
|
74
|
-
|
|
82
|
+
all_by_values = [by_value, by_sha, by_path, by_rule, by_package, by_cve]
|
|
83
|
+
if all(by is None for by in all_by_values):
|
|
84
|
+
raise click.ClickException('Ignore by type is missing')
|
|
85
|
+
if len([by for by in all_by_values if by is not None]) != 1:
|
|
86
|
+
raise click.ClickException('You must specify only one ignore by type')
|
|
75
87
|
|
|
76
88
|
if any(by is not None for by in [by_value, by_sha]) and scan_type != consts.SECRET_SCAN_TYPE:
|
|
77
|
-
raise click.ClickException('
|
|
89
|
+
raise click.ClickException('This exclude is supported only for Secret scan type')
|
|
90
|
+
if (by_cve or by_package) and scan_type != consts.SCA_SCAN_TYPE:
|
|
91
|
+
raise click.ClickException('This exclude is supported only for SCA scan type')
|
|
92
|
+
|
|
93
|
+
# only one of the by values must be set
|
|
94
|
+
# at least one of the by values must be set
|
|
95
|
+
exclusion_type = exclusion_value = None
|
|
78
96
|
|
|
79
|
-
if by_value
|
|
97
|
+
if by_value:
|
|
80
98
|
exclusion_type = consts.EXCLUSIONS_BY_VALUE_SECTION_NAME
|
|
81
99
|
exclusion_value = hash_string_to_sha256(by_value)
|
|
82
|
-
|
|
100
|
+
|
|
101
|
+
if by_sha:
|
|
83
102
|
exclusion_type = consts.EXCLUSIONS_BY_SHA_SECTION_NAME
|
|
84
103
|
exclusion_value = by_sha
|
|
85
|
-
|
|
104
|
+
|
|
105
|
+
if by_path:
|
|
86
106
|
absolute_path = get_absolute_path(by_path)
|
|
87
|
-
if not
|
|
88
|
-
raise click.ClickException('
|
|
107
|
+
if not is_path_exists(absolute_path):
|
|
108
|
+
raise click.ClickException('The provided path to ignore by does not exist')
|
|
109
|
+
|
|
89
110
|
exclusion_type = consts.EXCLUSIONS_BY_PATH_SECTION_NAME
|
|
90
111
|
exclusion_value = get_absolute_path(absolute_path)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
112
|
+
|
|
113
|
+
if by_rule:
|
|
114
|
+
exclusion_type = consts.EXCLUSIONS_BY_RULE_SECTION_NAME
|
|
115
|
+
exclusion_value = by_rule
|
|
116
|
+
|
|
117
|
+
if by_package:
|
|
94
118
|
if not _is_package_pattern_valid(by_package):
|
|
95
119
|
raise click.ClickException('wrong package pattern. should be name@version.')
|
|
120
|
+
|
|
96
121
|
exclusion_type = consts.EXCLUSIONS_BY_PACKAGE_SECTION_NAME
|
|
97
122
|
exclusion_value = by_package
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
123
|
+
|
|
124
|
+
if by_cve:
|
|
125
|
+
exclusion_type = consts.EXCLUSIONS_BY_CVE_SECTION_NAME
|
|
126
|
+
exclusion_value = by_cve
|
|
127
|
+
|
|
128
|
+
if not exclusion_type or not exclusion_value:
|
|
129
|
+
# should never happen
|
|
130
|
+
raise click.ClickException('Invalid ignore by type')
|
|
101
131
|
|
|
102
132
|
configuration_scope = 'global' if is_global else 'local'
|
|
103
133
|
logger.debug(
|
|
@@ -3,6 +3,7 @@ from typing import Optional
|
|
|
3
3
|
|
|
4
4
|
import click
|
|
5
5
|
|
|
6
|
+
from cycode import __version__
|
|
6
7
|
from cycode.cli.commands.ai_remediation.ai_remediation_command import ai_remediation_command
|
|
7
8
|
from cycode.cli.commands.auth.auth_command import auth_command
|
|
8
9
|
from cycode.cli.commands.configure.configure_command import configure_command
|
|
@@ -10,6 +11,7 @@ from cycode.cli.commands.ignore.ignore_command import ignore_command
|
|
|
10
11
|
from cycode.cli.commands.report.report_command import report_command
|
|
11
12
|
from cycode.cli.commands.scan.scan_command import scan_command
|
|
12
13
|
from cycode.cli.commands.status.status_command import status_command
|
|
14
|
+
from cycode.cli.commands.version.version_checker import version_checker
|
|
13
15
|
from cycode.cli.commands.version.version_command import version_command
|
|
14
16
|
from cycode.cli.consts import (
|
|
15
17
|
CLI_CONTEXT_SETTINGS,
|
|
@@ -48,6 +50,12 @@ from cycode.cyclient.models import UserAgentOptionScheme
|
|
|
48
50
|
default=False,
|
|
49
51
|
help='Do not show the progress meter.',
|
|
50
52
|
)
|
|
53
|
+
@click.option(
|
|
54
|
+
'--no-update-notifier',
|
|
55
|
+
is_flag=True,
|
|
56
|
+
default=False,
|
|
57
|
+
help='Do not check CLI for updates.',
|
|
58
|
+
)
|
|
51
59
|
@click.option(
|
|
52
60
|
'--output',
|
|
53
61
|
'-o',
|
|
@@ -63,7 +71,12 @@ from cycode.cyclient.models import UserAgentOptionScheme
|
|
|
63
71
|
)
|
|
64
72
|
@click.pass_context
|
|
65
73
|
def main_cli(
|
|
66
|
-
context: click.Context,
|
|
74
|
+
context: click.Context,
|
|
75
|
+
verbose: bool,
|
|
76
|
+
no_progress_meter: bool,
|
|
77
|
+
no_update_notifier: bool,
|
|
78
|
+
output: str,
|
|
79
|
+
user_agent: Optional[str],
|
|
67
80
|
) -> None:
|
|
68
81
|
init_sentry()
|
|
69
82
|
add_breadcrumb('cycode')
|
|
@@ -85,3 +98,20 @@ def main_cli(
|
|
|
85
98
|
if user_agent:
|
|
86
99
|
user_agent_option = UserAgentOptionScheme().loads(user_agent)
|
|
87
100
|
CycodeClientBase.enrich_user_agent(user_agent_option.user_agent_suffix)
|
|
101
|
+
|
|
102
|
+
if not no_update_notifier:
|
|
103
|
+
context.call_on_close(lambda: check_latest_version_on_close())
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@click.pass_context
|
|
107
|
+
def check_latest_version_on_close(context: click.Context) -> None:
|
|
108
|
+
output = context.obj.get('output')
|
|
109
|
+
# don't print anything if the output is JSON
|
|
110
|
+
if output == 'json':
|
|
111
|
+
return
|
|
112
|
+
|
|
113
|
+
# we always want to check the latest version for "version" and "status" commands
|
|
114
|
+
should_use_cache = context.invoked_subcommand not in {'version', 'status'}
|
|
115
|
+
version_checker.check_and_notify_update(
|
|
116
|
+
current_version=__version__, use_color=context.color, use_cache=should_use_cache
|
|
117
|
+
)
|
|
@@ -764,58 +764,68 @@ def _exclude_detections_by_exclusions_configuration(detections: List[Detection],
|
|
|
764
764
|
|
|
765
765
|
|
|
766
766
|
def _should_exclude_detection(detection: Detection, exclusions: Dict) -> bool:
|
|
767
|
+
# FIXME(MarshalX): what the difference between by_value and by_sha?
|
|
767
768
|
exclusions_by_value = exclusions.get(consts.EXCLUSIONS_BY_VALUE_SECTION_NAME, [])
|
|
768
769
|
if _is_detection_sha_configured_in_exclusions(detection, exclusions_by_value):
|
|
769
770
|
logger.debug(
|
|
770
|
-
'
|
|
771
|
-
{'value_sha': detection.detection_details.get('sha512'
|
|
771
|
+
'Ignoring violation because its value is on the ignore list, %s',
|
|
772
|
+
{'value_sha': detection.detection_details.get('sha512')},
|
|
772
773
|
)
|
|
773
774
|
return True
|
|
774
775
|
|
|
775
776
|
exclusions_by_sha = exclusions.get(consts.EXCLUSIONS_BY_SHA_SECTION_NAME, [])
|
|
776
777
|
if _is_detection_sha_configured_in_exclusions(detection, exclusions_by_sha):
|
|
777
778
|
logger.debug(
|
|
778
|
-
'
|
|
779
|
-
{'sha': detection.detection_details.get('sha512'
|
|
779
|
+
'Ignoring violation because its SHA value is on the ignore list, %s',
|
|
780
|
+
{'sha': detection.detection_details.get('sha512')},
|
|
780
781
|
)
|
|
781
782
|
return True
|
|
782
783
|
|
|
783
784
|
exclusions_by_rule = exclusions.get(consts.EXCLUSIONS_BY_RULE_SECTION_NAME, [])
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
return True
|
|
785
|
+
detection_rule_id = detection.detection_rule_id
|
|
786
|
+
if detection_rule_id in exclusions_by_rule:
|
|
787
|
+
logger.debug(
|
|
788
|
+
'Ignoring violation because its Detection Rule ID is on the ignore list, %s',
|
|
789
|
+
{'detection_rule_id': detection_rule_id},
|
|
790
|
+
)
|
|
791
|
+
return True
|
|
792
792
|
|
|
793
793
|
exclusions_by_package = exclusions.get(consts.EXCLUSIONS_BY_PACKAGE_SECTION_NAME, [])
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
794
|
+
package = _get_package_name(detection)
|
|
795
|
+
if package and package in exclusions_by_package:
|
|
796
|
+
logger.debug('Ignoring violation because its package@version is on the ignore list, %s', {'package': package})
|
|
797
|
+
return True
|
|
798
|
+
|
|
799
|
+
exclusions_by_cve = exclusions.get(consts.EXCLUSIONS_BY_CVE_SECTION_NAME, [])
|
|
800
|
+
cve = _get_cve_identifier(detection)
|
|
801
|
+
if cve and cve in exclusions_by_cve:
|
|
802
|
+
logger.debug('Ignoring violation because its CVE is on the ignore list, %s', {'cve': cve})
|
|
803
|
+
return True
|
|
801
804
|
|
|
802
805
|
return False
|
|
803
806
|
|
|
804
807
|
|
|
805
808
|
def _is_detection_sha_configured_in_exclusions(detection: Detection, exclusions: List[str]) -> bool:
|
|
806
|
-
detection_sha = detection.detection_details.get('sha512'
|
|
809
|
+
detection_sha = detection.detection_details.get('sha512')
|
|
807
810
|
return detection_sha in exclusions
|
|
808
811
|
|
|
809
812
|
|
|
810
|
-
def _get_package_name(detection: Detection) -> str:
|
|
811
|
-
package_name = detection.detection_details.get('vulnerable_component'
|
|
812
|
-
package_version = detection.detection_details.get('vulnerable_component_version'
|
|
813
|
+
def _get_package_name(detection: Detection) -> Optional[str]:
|
|
814
|
+
package_name = detection.detection_details.get('vulnerable_component')
|
|
815
|
+
package_version = detection.detection_details.get('vulnerable_component_version')
|
|
816
|
+
|
|
817
|
+
if package_name is None:
|
|
818
|
+
package_name = detection.detection_details.get('package_name')
|
|
819
|
+
package_version = detection.detection_details.get('package_version')
|
|
820
|
+
|
|
821
|
+
if package_name and package_version:
|
|
822
|
+
return f'{package_name}@{package_version}'
|
|
823
|
+
|
|
824
|
+
return None
|
|
813
825
|
|
|
814
|
-
if package_name == '':
|
|
815
|
-
package_name = detection.detection_details.get('package_name', '')
|
|
816
|
-
package_version = detection.detection_details.get('package_version', '')
|
|
817
826
|
|
|
818
|
-
|
|
827
|
+
def _get_cve_identifier(detection: Detection) -> Optional[str]:
|
|
828
|
+
return detection.detection_details.get('alert', {}).get('cve_identifier')
|
|
819
829
|
|
|
820
830
|
|
|
821
831
|
def _get_document_by_file_name(
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import re
|
|
3
|
+
import time
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import List, Optional, Tuple
|
|
6
|
+
|
|
7
|
+
import click
|
|
8
|
+
|
|
9
|
+
from cycode.cli.user_settings.configuration_manager import ConfigurationManager
|
|
10
|
+
from cycode.cli.utils.path_utils import get_file_content
|
|
11
|
+
from cycode.cyclient.cycode_client_base import CycodeClientBase
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _compare_versions(
|
|
15
|
+
current_parts: List[int],
|
|
16
|
+
latest_parts: List[int],
|
|
17
|
+
current_is_pre: bool,
|
|
18
|
+
latest_is_pre: bool,
|
|
19
|
+
latest_version: str,
|
|
20
|
+
) -> Optional[str]:
|
|
21
|
+
"""Compare version numbers and determine if an update is needed.
|
|
22
|
+
|
|
23
|
+
Implements version comparison logic with special handling for pre-release versions:
|
|
24
|
+
- Won't suggest downgrading from stable to pre-release
|
|
25
|
+
- Will suggest upgrading from pre-release to stable of the same version
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
current_parts: List of numeric version components for the current version
|
|
29
|
+
latest_parts: List of numeric version components for the latest version
|
|
30
|
+
current_is_pre: Whether the current version is pre-release
|
|
31
|
+
latest_is_pre: Whether the latest version is pre-release
|
|
32
|
+
latest_version: The full latest version string
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
str | None: The latest version string if an update is recommended,
|
|
36
|
+
None if no update is needed
|
|
37
|
+
"""
|
|
38
|
+
# If current is stable and latest is pre-release, don't suggest update
|
|
39
|
+
if not current_is_pre and latest_is_pre:
|
|
40
|
+
return None
|
|
41
|
+
|
|
42
|
+
# Compare version numbers
|
|
43
|
+
for current, latest in zip(current_parts, latest_parts):
|
|
44
|
+
if latest > current:
|
|
45
|
+
return latest_version
|
|
46
|
+
if current > latest:
|
|
47
|
+
return None
|
|
48
|
+
|
|
49
|
+
# If all numbers are equal, suggest update if current is pre-release and latest is stable
|
|
50
|
+
if current_is_pre and not latest_is_pre:
|
|
51
|
+
return latest_version
|
|
52
|
+
|
|
53
|
+
return None
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class VersionChecker(CycodeClientBase):
|
|
57
|
+
PYPI_API_URL = 'https://pypi.org/pypi'
|
|
58
|
+
PYPI_PACKAGE_NAME = 'cycode'
|
|
59
|
+
|
|
60
|
+
GIT_CHANGELOG_URL_PREFIX = 'https://github.com/cycodehq/cycode-cli/releases/tag/v'
|
|
61
|
+
|
|
62
|
+
DAILY = 24 * 60 * 60 # 24 hours in seconds
|
|
63
|
+
WEEKLY = DAILY * 7
|
|
64
|
+
|
|
65
|
+
def __init__(self) -> None:
|
|
66
|
+
"""Initialize the VersionChecker.
|
|
67
|
+
|
|
68
|
+
Sets up the version checker with PyPI API URL and configure the cache file location
|
|
69
|
+
using the global configuration directory.
|
|
70
|
+
"""
|
|
71
|
+
super().__init__(self.PYPI_API_URL)
|
|
72
|
+
|
|
73
|
+
configuration_manager = ConfigurationManager()
|
|
74
|
+
config_dir = configuration_manager.global_config_file_manager.get_config_directory_path()
|
|
75
|
+
self.cache_file = Path(config_dir) / '.version_check'
|
|
76
|
+
|
|
77
|
+
def get_latest_version(self) -> Optional[str]:
|
|
78
|
+
"""Fetch the latest version of the package from PyPI.
|
|
79
|
+
|
|
80
|
+
Makes an HTTP request to PyPI's JSON API to get the latest version information.
|
|
81
|
+
|
|
82
|
+
Returns:
|
|
83
|
+
str | None: The latest version string if successful, None if the request fails
|
|
84
|
+
or the version information is not available.
|
|
85
|
+
"""
|
|
86
|
+
try:
|
|
87
|
+
response = self.get(f'{self.PYPI_PACKAGE_NAME}/json')
|
|
88
|
+
data = response.json()
|
|
89
|
+
return data.get('info', {}).get('version')
|
|
90
|
+
except Exception:
|
|
91
|
+
return None
|
|
92
|
+
|
|
93
|
+
@staticmethod
|
|
94
|
+
def _parse_version(version: str) -> Tuple[List[int], bool]:
|
|
95
|
+
"""Parse version string into components and identify if it's a pre-release.
|
|
96
|
+
|
|
97
|
+
Extracts numeric version components and determines if the version is a pre-release
|
|
98
|
+
by checking for 'dev' in the version string.
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
version: The version string to parse (e.g., '1.2.3' or '1.2.3dev4')
|
|
102
|
+
|
|
103
|
+
Returns:
|
|
104
|
+
tuple: A tuple containing:
|
|
105
|
+
- List[int]: List of numeric version components
|
|
106
|
+
- bool: True if this is a pre-release version, False otherwise
|
|
107
|
+
"""
|
|
108
|
+
version_parts = [int(x) for x in re.findall(r'\d+', version)]
|
|
109
|
+
is_prerelease = 'dev' in version
|
|
110
|
+
|
|
111
|
+
return version_parts, is_prerelease
|
|
112
|
+
|
|
113
|
+
def _should_check_update(self, is_prerelease: bool) -> bool:
|
|
114
|
+
"""Determine if an update check should be performed based on the last check time.
|
|
115
|
+
|
|
116
|
+
Implements a time-based caching mechanism where update checks are performed:
|
|
117
|
+
- Daily for pre-release versions
|
|
118
|
+
- Weekly for stable versions
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
is_prerelease: Whether the current version is a pre-release
|
|
122
|
+
|
|
123
|
+
Returns:
|
|
124
|
+
bool: True if an update check should be performed, False otherwise
|
|
125
|
+
"""
|
|
126
|
+
if not os.path.exists(self.cache_file):
|
|
127
|
+
return True
|
|
128
|
+
|
|
129
|
+
file_content = get_file_content(self.cache_file)
|
|
130
|
+
if file_content is None:
|
|
131
|
+
return True
|
|
132
|
+
|
|
133
|
+
try:
|
|
134
|
+
last_check = float(file_content.strip())
|
|
135
|
+
except ValueError:
|
|
136
|
+
return True
|
|
137
|
+
|
|
138
|
+
duration = self.DAILY if is_prerelease else self.WEEKLY
|
|
139
|
+
return time.time() - last_check >= duration
|
|
140
|
+
|
|
141
|
+
def _update_last_check(self) -> None:
|
|
142
|
+
"""Update the timestamp of the last update check.
|
|
143
|
+
|
|
144
|
+
Creates the cache directory if it doesn't exist and write the current timestamp
|
|
145
|
+
to the cache file. Silently handle any IO errors that might occur during the process.
|
|
146
|
+
"""
|
|
147
|
+
try:
|
|
148
|
+
os.makedirs(os.path.dirname(self.cache_file), exist_ok=True)
|
|
149
|
+
with open(self.cache_file, 'w', encoding='UTF-8') as f:
|
|
150
|
+
f.write(str(time.time()))
|
|
151
|
+
except IOError:
|
|
152
|
+
pass
|
|
153
|
+
|
|
154
|
+
def check_for_update(self, current_version: str, use_cache: bool = True) -> Optional[str]:
|
|
155
|
+
"""Check if an update is available for the current version.
|
|
156
|
+
|
|
157
|
+
Respects the update check frequency (daily/weekly) based on the version type
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
current_version: The current version string of the CLI
|
|
161
|
+
use_cache: If True, use the cached timestamp to determine if an update check is needed
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
str | None: The latest version string if an update is recommended,
|
|
165
|
+
None if no update is needed or if check should be skipped
|
|
166
|
+
"""
|
|
167
|
+
current_parts, current_is_pre = self._parse_version(current_version)
|
|
168
|
+
|
|
169
|
+
# Check if we should perform the update check based on frequency
|
|
170
|
+
if use_cache and not self._should_check_update(current_is_pre):
|
|
171
|
+
return None
|
|
172
|
+
|
|
173
|
+
latest_version = self.get_latest_version()
|
|
174
|
+
if not latest_version:
|
|
175
|
+
return None
|
|
176
|
+
|
|
177
|
+
# Update the last check timestamp
|
|
178
|
+
use_cache and self._update_last_check()
|
|
179
|
+
|
|
180
|
+
latest_parts, latest_is_pre = self._parse_version(latest_version)
|
|
181
|
+
return _compare_versions(current_parts, latest_parts, current_is_pre, latest_is_pre, latest_version)
|
|
182
|
+
|
|
183
|
+
def check_and_notify_update(self, current_version: str, use_color: bool = True, use_cache: bool = True) -> None:
|
|
184
|
+
"""Check for updates and display a notification if a new version is available.
|
|
185
|
+
|
|
186
|
+
Performs the version check and displays a formatted message with update instructions
|
|
187
|
+
if a newer version is available. The message includes:
|
|
188
|
+
- Current and new version numbers
|
|
189
|
+
- Link to the changelog
|
|
190
|
+
- Command to perform the update
|
|
191
|
+
|
|
192
|
+
Args:
|
|
193
|
+
current_version: Current version of the CLI
|
|
194
|
+
use_color: If True, use colored output in the terminal
|
|
195
|
+
use_cache: If True, use the cached timestamp to determine if an update check is needed
|
|
196
|
+
"""
|
|
197
|
+
latest_version = self.check_for_update(current_version, use_cache)
|
|
198
|
+
should_update = bool(latest_version)
|
|
199
|
+
if should_update:
|
|
200
|
+
update_message = (
|
|
201
|
+
'\nNew version of cycode available! '
|
|
202
|
+
f"{click.style(current_version, fg='yellow')} → {click.style(latest_version, fg='bright_blue')}\n"
|
|
203
|
+
f"Changelog: {click.style(f'{self.GIT_CHANGELOG_URL_PREFIX}{latest_version}', fg='bright_blue')}\n"
|
|
204
|
+
f"Run {click.style('pip install --upgrade cycode', fg='green')} to update\n"
|
|
205
|
+
)
|
|
206
|
+
click.echo(update_message, color=use_color)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
version_checker = VersionChecker()
|
|
@@ -131,6 +131,7 @@ EXCLUSIONS_BY_SHA_SECTION_NAME = 'shas'
|
|
|
131
131
|
EXCLUSIONS_BY_PATH_SECTION_NAME = 'paths'
|
|
132
132
|
EXCLUSIONS_BY_RULE_SECTION_NAME = 'rules'
|
|
133
133
|
EXCLUSIONS_BY_PACKAGE_SECTION_NAME = 'packages'
|
|
134
|
+
EXCLUSIONS_BY_CVE_SECTION_NAME = 'cves'
|
|
134
135
|
|
|
135
136
|
# 5MB in bytes (in decimal)
|
|
136
137
|
FILE_MAX_SIZE_LIMIT_IN_BYTES = 5000000
|
|
@@ -24,7 +24,8 @@ def _walk_to_top(path: str) -> Iterable[str]:
|
|
|
24
24
|
|
|
25
25
|
def _collect_top_level_ignore_files(path: str) -> List[str]:
|
|
26
26
|
ignore_files = []
|
|
27
|
-
|
|
27
|
+
top_paths = reversed(list(_walk_to_top(path))) # we must reverse it to make top levels more prioritized
|
|
28
|
+
for dir_path in top_paths:
|
|
28
29
|
for ignore_file in _SUPPORTED_IGNORE_PATTERN_FILES:
|
|
29
30
|
ignore_file_path = os.path.join(dir_path, ignore_file)
|
|
30
31
|
if os.path.exists(ignore_file_path):
|
|
@@ -79,7 +79,8 @@ class ConfigurationManager:
|
|
|
79
79
|
config_file_manager = self.get_config_file_manager(scope)
|
|
80
80
|
config_file_manager.add_exclusion(scan_type, exclusion_type, value)
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
@staticmethod
|
|
83
|
+
def _merge_exclusions(local_exclusions: Dict, global_exclusions: Dict) -> Dict:
|
|
83
84
|
keys = set(list(local_exclusions.keys()) + list(global_exclusions.keys()))
|
|
84
85
|
return {key: local_exclusions.get(key, []) + global_exclusions.get(key, []) for key in keys}
|
|
85
86
|
|
|
@@ -396,12 +396,10 @@ class IgnoreFilterManager:
|
|
|
396
396
|
|
|
397
397
|
# decrease recursion depth of os.walk() by ignoring subdirectories because of topdown=True
|
|
398
398
|
# slicing ([:]) is mandatory to change dict in-place!
|
|
399
|
-
dirnames[:] = [
|
|
400
|
-
dirname for dirname in dirnames if not self.is_ignored(os.path.join(rel_dirpath, dirname, ''))
|
|
401
|
-
]
|
|
399
|
+
dirnames[:] = [d for d in dirnames if not self.is_ignored(os.path.join(rel_dirpath, d))]
|
|
402
400
|
|
|
403
401
|
# remove ignored files
|
|
404
|
-
filenames = [
|
|
402
|
+
filenames = [f for f in filenames if not self.is_ignored(os.path.join(rel_dirpath, f))]
|
|
405
403
|
|
|
406
404
|
yield dirpath, dirnames, filenames
|
|
407
405
|
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import os
|
|
3
3
|
from functools import lru_cache
|
|
4
|
-
from typing import AnyStr, List, Optional
|
|
4
|
+
from typing import TYPE_CHECKING, AnyStr, List, Optional, Union
|
|
5
5
|
|
|
6
6
|
import click
|
|
7
7
|
from binaryornot.helpers import is_binary_string
|
|
8
8
|
|
|
9
9
|
from cycode.cyclient import logger
|
|
10
10
|
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from os import PathLike
|
|
13
|
+
|
|
11
14
|
|
|
12
15
|
@lru_cache(maxsize=None)
|
|
13
16
|
def is_sub_path(path: str, sub_path: str) -> bool:
|
|
@@ -73,7 +76,7 @@ def join_paths(path: str, filename: str) -> str:
|
|
|
73
76
|
return os.path.join(path, filename)
|
|
74
77
|
|
|
75
78
|
|
|
76
|
-
def get_file_content(file_path: str) -> Optional[AnyStr]:
|
|
79
|
+
def get_file_content(file_path: Union[str, 'PathLike']) -> Optional[AnyStr]:
|
|
77
80
|
try:
|
|
78
81
|
with open(file_path, 'r', encoding='UTF-8') as f:
|
|
79
82
|
return f.read()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "cycode"
|
|
3
|
-
version = "2.1.
|
|
3
|
+
version = "2.2.1.dev1" # 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__ = '2.1.2.dev1' # 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
|
{cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/ai_remediation/ai_remediation_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
|
{cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/report/sbom/path/path_command.py
RENAMED
|
File without changes
|
{cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/report/sbom/repository_url/__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
|
{cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/pre_commit/pre_commit_command.py
RENAMED
|
File without changes
|
|
File without changes
|
{cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/pre_receive/pre_receive_command.py
RENAMED
|
File without changes
|
|
File without changes
|
{cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/commands/scan/repository/repository_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
|
{cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/exceptions/handle_ai_remediation_errors.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/iac/tf_content_generator.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/sca/base_restore_dependencies.py
RENAMED
|
File without changes
|
|
File without changes
|
{cycode-2.1.2.dev1 → cycode-2.2.1.dev1}/cycode/cli/files_collector/sca/go/restore_go_dependencies.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
|