cycode 2.3.4.dev3__tar.gz → 3.0.0__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.3.4.dev3 → cycode-3.0.0}/PKG-INFO +29 -33
- {cycode-2.3.4.dev3 → cycode-3.0.0}/README.md +25 -29
- cycode-3.0.0/cycode/__init__.py +1 -0
- cycode-3.0.0/cycode/__main__.py +4 -0
- cycode-3.0.0/cycode/cli/app.py +156 -0
- cycode-3.0.0/cycode/cli/apps/ai_remediation/__init__.py +20 -0
- cycode-3.0.0/cycode/cli/apps/ai_remediation/ai_remediation_command.py +39 -0
- cycode-3.0.0/cycode/cli/apps/ai_remediation/apply_fix.py +24 -0
- cycode-3.0.0/cycode/cli/apps/ai_remediation/print_remediation.py +14 -0
- cycode-3.0.0/cycode/cli/apps/auth/__init__.py +9 -0
- cycode-3.0.0/cycode/cli/apps/auth/auth_command.py +31 -0
- {cycode-2.3.4.dev3/cycode/cli/commands → cycode-3.0.0/cycode/cli/apps/auth}/auth_common.py +12 -11
- {cycode-2.3.4.dev3/cycode/cli/commands → cycode-3.0.0/cycode/cli/apps}/auth/auth_manager.py +8 -15
- cycode-3.0.0/cycode/cli/apps/auth/models.py +6 -0
- cycode-3.0.0/cycode/cli/apps/configure/__init__.py +14 -0
- cycode-3.0.0/cycode/cli/apps/configure/configure_command.py +69 -0
- cycode-3.0.0/cycode/cli/apps/configure/consts.py +19 -0
- cycode-3.0.0/cycode/cli/apps/configure/messages.py +37 -0
- cycode-3.0.0/cycode/cli/apps/configure/prompts.py +48 -0
- cycode-3.0.0/cycode/cli/apps/ignore/__init__.py +6 -0
- cycode-3.0.0/cycode/cli/apps/ignore/ignore_command.py +161 -0
- cycode-3.0.0/cycode/cli/apps/report/__init__.py +8 -0
- cycode-3.0.0/cycode/cli/apps/report/report_command.py +15 -0
- cycode-3.0.0/cycode/cli/apps/report/sbom/__init__.py +15 -0
- {cycode-2.3.4.dev3/cycode/cli/commands → cycode-3.0.0/cycode/cli/apps}/report/sbom/common.py +3 -3
- {cycode-2.3.4.dev3/cycode/cli/commands → cycode-3.0.0/cycode/cli/apps}/report/sbom/path/path_command.py +19 -14
- {cycode-2.3.4.dev3/cycode/cli/commands → cycode-3.0.0/cycode/cli/apps}/report/sbom/repository_url/repository_url_command.py +13 -12
- cycode-3.0.0/cycode/cli/apps/report/sbom/sbom_command.py +72 -0
- {cycode-2.3.4.dev3/cycode/cli/commands → cycode-3.0.0/cycode/cli/apps}/report/sbom/sbom_report_file.py +5 -3
- cycode-3.0.0/cycode/cli/apps/scan/__init__.py +41 -0
- {cycode-2.3.4.dev3/cycode/cli/commands → cycode-3.0.0/cycode/cli/apps}/scan/code_scanner.py +164 -189
- cycode-3.0.0/cycode/cli/apps/scan/commit_history/commit_history_command.py +33 -0
- cycode-3.0.0/cycode/cli/apps/scan/path/path_command.py +25 -0
- {cycode-2.3.4.dev3/cycode/cli/commands → cycode-3.0.0/cycode/cli/apps}/scan/pre_commit/pre_commit_command.py +15 -13
- {cycode-2.3.4.dev3/cycode/cli/commands → cycode-3.0.0/cycode/cli/apps}/scan/pre_receive/pre_receive_command.py +15 -14
- {cycode-2.3.4.dev3/cycode/cli/commands → cycode-3.0.0/cycode/cli/apps}/scan/repository/repository_command.py +26 -27
- {cycode-2.3.4.dev3/cycode/cli/commands → cycode-3.0.0/cycode/cli/apps}/scan/scan_ci/ci_integrations.py +4 -2
- cycode-3.0.0/cycode/cli/apps/scan/scan_ci/scan_ci_command.py +20 -0
- cycode-3.0.0/cycode/cli/apps/scan/scan_command.py +178 -0
- cycode-3.0.0/cycode/cli/apps/status/__init__.py +8 -0
- cycode-3.0.0/cycode/cli/apps/status/get_cli_status.py +49 -0
- cycode-3.0.0/cycode/cli/apps/status/models.py +61 -0
- cycode-3.0.0/cycode/cli/apps/status/status_command.py +31 -0
- cycode-3.0.0/cycode/cli/apps/status/version_command.py +10 -0
- cycode-3.0.0/cycode/cli/cli_types.py +107 -0
- cycode-3.0.0/cycode/cli/config.py +7 -0
- cycode-3.0.0/cycode/cli/console.py +69 -0
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/consts.py +16 -11
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/exceptions/custom_exceptions.py +12 -11
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/exceptions/handle_ai_remediation_errors.py +4 -4
- cycode-3.0.0/cycode/cli/exceptions/handle_auth_errors.py +18 -0
- cycode-2.3.4.dev3/cycode/cli/exceptions/common.py → cycode-3.0.0/cycode/cli/exceptions/handle_errors.py +10 -9
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/exceptions/handle_report_sbom_errors.py +4 -4
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/exceptions/handle_scan_errors.py +7 -10
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/files_collector/excluder.py +10 -7
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/files_collector/iac/tf_content_generator.py +4 -5
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/files_collector/models/in_memory_zip.py +1 -1
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/files_collector/path_documents.py +10 -10
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/files_collector/repository_documents.py +26 -20
- cycode-3.0.0/cycode/cli/files_collector/sca/base_restore_dependencies.py +94 -0
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/files_collector/sca/go/restore_go_dependencies.py +7 -10
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/files_collector/sca/maven/restore_gradle_dependencies.py +14 -18
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/files_collector/sca/maven/restore_maven_dependencies.py +17 -19
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/files_collector/sca/npm/restore_npm_dependencies.py +6 -9
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/files_collector/sca/nuget/restore_nuget_dependencies.py +4 -10
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/files_collector/sca/ruby/restore_ruby_dependencies.py +2 -5
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/files_collector/sca/sbt/restore_sbt_dependencies.py +2 -5
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/files_collector/sca/sca_code_scanner.py +48 -37
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/files_collector/walk_ignore.py +4 -4
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/files_collector/zip_documents.py +11 -6
- cycode-3.0.0/cycode/cli/logger.py +3 -0
- cycode-3.0.0/cycode/cli/main.py +10 -0
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/models.py +13 -38
- cycode-3.0.0/cycode/cli/printers/console_printer.py +159 -0
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/printers/json_printer.py +8 -11
- cycode-3.0.0/cycode/cli/printers/printer_base.py +115 -0
- cycode-3.0.0/cycode/cli/printers/rich_printer.py +177 -0
- cycode-3.0.0/cycode/cli/printers/tables/sca_table_printer.py +138 -0
- cycode-3.0.0/cycode/cli/printers/tables/table.py +64 -0
- cycode-3.0.0/cycode/cli/printers/tables/table_models.py +25 -0
- cycode-3.0.0/cycode/cli/printers/tables/table_printer.py +102 -0
- cycode-3.0.0/cycode/cli/printers/tables/table_printer_base.py +42 -0
- cycode-3.0.0/cycode/cli/printers/text_printer.py +137 -0
- cycode-3.0.0/cycode/cli/printers/utils/__init__.py +8 -0
- cycode-3.0.0/cycode/cli/printers/utils/code_snippet_syntax.py +117 -0
- cycode-3.0.0/cycode/cli/printers/utils/detection_data.py +108 -0
- cycode-3.0.0/cycode/cli/printers/utils/detection_ordering/common_ordering.py +57 -0
- cycode-3.0.0/cycode/cli/printers/utils/detection_ordering/sca_ordering.py +59 -0
- cycode-3.0.0/cycode/cli/printers/utils/rich_helpers.py +37 -0
- cycode-3.0.0/cycode/cli/user_settings/base_file_manager.py +19 -0
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/user_settings/config_file_manager.py +6 -5
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/user_settings/configuration_manager.py +5 -5
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/user_settings/credentials_manager.py +6 -6
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/utils/enum_utils.py +1 -2
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/utils/get_api_client.py +11 -8
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/utils/git_proxy.py +10 -10
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/utils/ignore_utils.py +16 -14
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/utils/jwt_utils.py +2 -2
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/utils/path_utils.py +12 -12
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/utils/progress_bar.py +44 -62
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/utils/scan_batch.py +12 -9
- cycode-3.0.0/cycode/cli/utils/scan_utils.py +11 -0
- {cycode-2.3.4.dev3/cycode/cli → cycode-3.0.0/cycode/cli/utils}/sentry.py +1 -1
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/utils/shell_executor.py +16 -5
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/utils/string_utils.py +1 -1
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/utils/task_timer.py +5 -7
- {cycode-2.3.4.dev3/cycode/cli/commands/version → cycode-3.0.0/cycode/cli/utils}/version_checker.py +22 -15
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/utils/yaml_utils.py +18 -17
- cycode-3.0.0/cycode/config.py +45 -0
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cyclient/auth_client.py +7 -2
- cycode-3.0.0/cycode/cyclient/config.py +36 -0
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cyclient/cycode_client_base.py +59 -6
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cyclient/cycode_dev_based_client.py +2 -2
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cyclient/headers.py +3 -2
- cycode-3.0.0/cycode/cyclient/logger.py +3 -0
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cyclient/models.py +35 -54
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cyclient/report_client.py +2 -2
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cyclient/scan_client.py +26 -117
- cycode-3.0.0/cycode/cyclient/scan_config_base.py +43 -0
- cycode-3.0.0/cycode/logger.py +65 -0
- {cycode-2.3.4.dev3 → cycode-3.0.0}/pyproject.toml +18 -10
- cycode-2.3.4.dev3/cycode/__init__.py +0 -1
- cycode-2.3.4.dev3/cycode/cli/commands/ai_remediation/ai_remediation_command.py +0 -67
- cycode-2.3.4.dev3/cycode/cli/commands/auth/auth_command.py +0 -82
- cycode-2.3.4.dev3/cycode/cli/commands/configure/configure_command.py +0 -140
- cycode-2.3.4.dev3/cycode/cli/commands/ignore/ignore_command.py +0 -141
- cycode-2.3.4.dev3/cycode/cli/commands/main_cli.py +0 -117
- cycode-2.3.4.dev3/cycode/cli/commands/report/report_command.py +0 -21
- cycode-2.3.4.dev3/cycode/cli/commands/report/sbom/sbom_command.py +0 -87
- cycode-2.3.4.dev3/cycode/cli/commands/scan/commit_history/commit_history_command.py +0 -27
- cycode-2.3.4.dev3/cycode/cli/commands/scan/path/path_command.py +0 -20
- cycode-2.3.4.dev3/cycode/cli/commands/scan/scan_ci/scan_ci_command.py +0 -19
- cycode-2.3.4.dev3/cycode/cli/commands/scan/scan_command.py +0 -187
- cycode-2.3.4.dev3/cycode/cli/commands/status/status_command.py +0 -122
- cycode-2.3.4.dev3/cycode/cli/commands/version/version_command.py +0 -22
- cycode-2.3.4.dev3/cycode/cli/config.py +0 -13
- cycode-2.3.4.dev3/cycode/cli/config.yaml +0 -25
- cycode-2.3.4.dev3/cycode/cli/files_collector/sca/base_restore_dependencies.py +0 -101
- cycode-2.3.4.dev3/cycode/cli/files_collector/sca/npm/__init__.py +0 -0
- cycode-2.3.4.dev3/cycode/cli/files_collector/sca/nuget/__init__.py +0 -0
- cycode-2.3.4.dev3/cycode/cli/files_collector/sca/ruby/__init__.py +0 -0
- cycode-2.3.4.dev3/cycode/cli/files_collector/sca/sbt/__init__.py +0 -0
- cycode-2.3.4.dev3/cycode/cli/main.py +0 -11
- cycode-2.3.4.dev3/cycode/cli/printers/console_printer.py +0 -74
- cycode-2.3.4.dev3/cycode/cli/printers/printer_base.py +0 -52
- cycode-2.3.4.dev3/cycode/cli/printers/tables/__init__.py +0 -0
- cycode-2.3.4.dev3/cycode/cli/printers/tables/sca_table_printer.py +0 -180
- cycode-2.3.4.dev3/cycode/cli/printers/tables/table.py +0 -62
- cycode-2.3.4.dev3/cycode/cli/printers/tables/table_models.py +0 -20
- cycode-2.3.4.dev3/cycode/cli/printers/tables/table_printer.py +0 -129
- cycode-2.3.4.dev3/cycode/cli/printers/tables/table_printer_base.py +0 -74
- cycode-2.3.4.dev3/cycode/cli/printers/text_printer.py +0 -261
- cycode-2.3.4.dev3/cycode/cli/user_settings/__init__.py +0 -0
- cycode-2.3.4.dev3/cycode/cli/user_settings/base_file_manager.py +0 -18
- cycode-2.3.4.dev3/cycode/cli/utils/__init__.py +0 -0
- cycode-2.3.4.dev3/cycode/cli/utils/scan_utils.py +0 -11
- cycode-2.3.4.dev3/cycode/cyclient/__init__.py +0 -5
- cycode-2.3.4.dev3/cycode/cyclient/config.py +0 -121
- cycode-2.3.4.dev3/cycode/cyclient/config.yaml +0 -5
- cycode-2.3.4.dev3/cycode/cyclient/scan_config_base.py +0 -59
- {cycode-2.3.4.dev3 → cycode-3.0.0}/LICENCE +0 -0
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/commands → cycode-3.0.0/cycode/cli/apps}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/commands/ai_remediation → cycode-3.0.0/cycode/cli/apps/report/sbom/path}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/commands/auth → cycode-3.0.0/cycode/cli/apps/report/sbom/repository_url}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/commands/configure → cycode-3.0.0/cycode/cli/apps/scan/commit_history}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/commands/ignore → cycode-3.0.0/cycode/cli/apps/scan/path}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/commands/report → cycode-3.0.0/cycode/cli/apps/scan/pre_commit}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/commands/report/sbom → cycode-3.0.0/cycode/cli/apps/scan/pre_receive}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/commands/report/sbom/path → cycode-3.0.0/cycode/cli/apps/scan/repository}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/commands/report/sbom/repository_url → cycode-3.0.0/cycode/cli/apps/scan/scan_ci}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/commands/scan → cycode-3.0.0/cycode/cli/exceptions}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/commands/scan/commit_history → cycode-3.0.0/cycode/cli/files_collector}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/commands/scan/path → cycode-3.0.0/cycode/cli/files_collector/iac}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/commands/scan/pre_commit → cycode-3.0.0/cycode/cli/files_collector/models}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/commands/scan/pre_receive → cycode-3.0.0/cycode/cli/files_collector/sca}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/commands/scan/repository → cycode-3.0.0/cycode/cli/files_collector/sca/go}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/commands/scan/scan_ci → cycode-3.0.0/cycode/cli/files_collector/sca/maven}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/commands/status → cycode-3.0.0/cycode/cli/files_collector/sca/npm}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/commands/version → cycode-3.0.0/cycode/cli/files_collector/sca/nuget}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/exceptions → cycode-3.0.0/cycode/cli/files_collector/sca/ruby}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/files_collector → cycode-3.0.0/cycode/cli/files_collector/sca/sbt}/__init__.py +0 -0
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/printers/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/files_collector/iac → cycode-3.0.0/cycode/cli/printers/tables}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/files_collector/models → cycode-3.0.0/cycode/cli/printers/utils/detection_ordering}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/files_collector/sca → cycode-3.0.0/cycode/cli/user_settings}/__init__.py +0 -0
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cli/user_settings/jwt_creator.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/files_collector/sca/go → cycode-3.0.0/cycode/cli/utils}/__init__.py +0 -0
- {cycode-2.3.4.dev3/cycode/cli/files_collector/sca/maven → cycode-3.0.0/cycode/cyclient}/__init__.py +0 -0
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cyclient/client_creator.py +0 -0
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cyclient/config_dev.py +0 -0
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cyclient/cycode_client.py +0 -0
- {cycode-2.3.4.dev3 → cycode-3.0.0}/cycode/cyclient/cycode_token_based_client.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cycode
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0
|
|
4
4
|
Summary: Boost security in your dev lifecycle via SAST, SCA, Secrets & IaC scanning.
|
|
5
5
|
Home-page: https://github.com/cycodehq/cycode-cli
|
|
6
6
|
License: MIT
|
|
7
7
|
Keywords: secret-scan,cycode,devops,token,secret,security,cycode,code
|
|
8
8
|
Author: Cycode
|
|
9
9
|
Author-email: support@cycode.com
|
|
10
|
-
Requires-Python: >=3.
|
|
10
|
+
Requires-Python: >=3.9,<3.14
|
|
11
11
|
Classifier: Development Status :: 5 - Production/Stable
|
|
12
12
|
Classifier: Environment :: Console
|
|
13
13
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -15,7 +15,6 @@ Classifier: Natural Language :: English
|
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Classifier: Programming Language :: Python
|
|
17
17
|
Classifier: Programming Language :: Python :: 3
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.9
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -34,7 +33,8 @@ Requires-Dist: pyyaml (>=6.0,<7.0)
|
|
|
34
33
|
Requires-Dist: requests (>=2.32.2,<3.0)
|
|
35
34
|
Requires-Dist: rich (>=13.9.4,<14)
|
|
36
35
|
Requires-Dist: sentry-sdk (>=2.8.0,<3.0)
|
|
37
|
-
Requires-Dist:
|
|
36
|
+
Requires-Dist: tenacity (>=9.0.0,<9.1.0)
|
|
37
|
+
Requires-Dist: typer (>=0.15.3,<0.16.0)
|
|
38
38
|
Requires-Dist: urllib3 (==1.26.19)
|
|
39
39
|
Project-URL: Repository, https://github.com/cycodehq/cycode-cli
|
|
40
40
|
Description-Content-Type: text/markdown
|
|
@@ -62,7 +62,7 @@ This guide walks you through both installation and usage.
|
|
|
62
62
|
1. [Options](#options)
|
|
63
63
|
1. [Severity Threshold](#severity-option)
|
|
64
64
|
2. [Monitor](#monitor-option)
|
|
65
|
-
3. [Report](#report-option)
|
|
65
|
+
3. [Cycode Report](#cycode-report-option)
|
|
66
66
|
4. [Package Vulnerabilities](#package-vulnerabilities-option)
|
|
67
67
|
5. [License Compliance](#license-compliance-option)
|
|
68
68
|
6. [Lock Restore](#lock-restore-option)
|
|
@@ -95,7 +95,7 @@ This guide walks you through both installation and usage.
|
|
|
95
95
|
|
|
96
96
|
# Prerequisites
|
|
97
97
|
|
|
98
|
-
- The Cycode CLI application requires Python version 3.
|
|
98
|
+
- The Cycode CLI application requires Python version 3.9 or later.
|
|
99
99
|
- Use the [`cycode auth` command](#using-the-auth-command) to authenticate to Cycode with the CLI
|
|
100
100
|
- Alternatively, you can get a Cycode Client ID and Client Secret Key by following the steps detailed in the [Service Account Token](https://docs.cycode.com/docs/en/service-accounts) and [Personal Access Token](https://docs.cycode.com/v1/docs/managing-personal-access-tokens) pages, which contain details on getting these values.
|
|
101
101
|
|
|
@@ -249,7 +249,7 @@ Cycode’s pre-commit hook can be set up within your local repository so that th
|
|
|
249
249
|
|
|
250
250
|
Perform the following steps to install the pre-commit hook:
|
|
251
251
|
|
|
252
|
-
1. Install the pre-commit framework (Python 3.
|
|
252
|
+
1. Install the pre-commit framework (Python 3.9 or higher must be installed):
|
|
253
253
|
|
|
254
254
|
```bash
|
|
255
255
|
pip3 install pre-commit
|
|
@@ -262,11 +262,11 @@ Perform the following steps to install the pre-commit hook:
|
|
|
262
262
|
```yaml
|
|
263
263
|
repos:
|
|
264
264
|
- repo: https://github.com/cycodehq/cycode-cli
|
|
265
|
-
rev:
|
|
265
|
+
rev: v3.0.0
|
|
266
266
|
hooks:
|
|
267
267
|
- id: cycode
|
|
268
268
|
stages:
|
|
269
|
-
- commit
|
|
269
|
+
- pre-commit
|
|
270
270
|
```
|
|
271
271
|
|
|
272
272
|
4. Modify the created file for your specific needs. Use hook ID `cycode` to enable scan for Secrets. Use hook ID `cycode-sca` to enable SCA scan. If you want to enable both, use this configuration:
|
|
@@ -274,14 +274,14 @@ Perform the following steps to install the pre-commit hook:
|
|
|
274
274
|
```yaml
|
|
275
275
|
repos:
|
|
276
276
|
- repo: https://github.com/cycodehq/cycode-cli
|
|
277
|
-
rev:
|
|
277
|
+
rev: v3.0.0
|
|
278
278
|
hooks:
|
|
279
279
|
- id: cycode
|
|
280
280
|
stages:
|
|
281
|
-
- commit
|
|
281
|
+
- pre-commit
|
|
282
282
|
- id: cycode-sca
|
|
283
283
|
stages:
|
|
284
|
-
- commit
|
|
284
|
+
- pre-commit
|
|
285
285
|
```
|
|
286
286
|
|
|
287
287
|
5. Install Cycode’s hook:
|
|
@@ -322,8 +322,8 @@ The following are the options and commands available with the Cycode CLI applica
|
|
|
322
322
|
| [auth](#using-the-auth-command) | Authenticate your machine to associate the CLI with your Cycode account. |
|
|
323
323
|
| [configure](#using-the-configure-command) | Initial command to configure your CLI client authentication. |
|
|
324
324
|
| [ignore](#ignoring-scan-results) | Ignores a specific value, path or rule ID. |
|
|
325
|
-
| [scan](#running-a-scan) | Scan the content for Secrets/IaC/SCA/SAST violations. You`ll need to specify which scan type to perform:
|
|
326
|
-
| [report](#report-command) | Generate report. You`ll need to specify which report type to perform.
|
|
325
|
+
| [scan](#running-a-scan) | Scan the content for Secrets/IaC/SCA/SAST violations. You`ll need to specify which scan type to perform: commit-history/path/repository/etc. |
|
|
326
|
+
| [report](#report-command) | Generate report. You`ll need to specify which report type to perform as SBOM. |
|
|
327
327
|
| status | Show the CLI status and exit. |
|
|
328
328
|
|
|
329
329
|
# Scan Command
|
|
@@ -335,24 +335,23 @@ The Cycode CLI application offers several types of scans so that you can choose
|
|
|
335
335
|
| Option | Description |
|
|
336
336
|
|------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
337
337
|
| `-t, --scan-type [secret\|iac\|sca\|sast]` | Specify the scan you wish to execute (`secret`/`iac`/`sca`/`sast`), the default is `secret`. |
|
|
338
|
-
| `--secret TEXT`
|
|
338
|
+
| `--client-secret TEXT` | Specify a Cycode client secret for this specific scan execution. |
|
|
339
339
|
| `--client-id TEXT` | Specify a Cycode client ID for this specific scan execution. |
|
|
340
340
|
| `--show-secret BOOLEAN` | Show secrets in plain text. See [Show/Hide Secrets](#showhide-secrets) section for more details. |
|
|
341
341
|
| `--soft-fail BOOLEAN` | Run scan without failing, always return a non-error status code. See [Soft Fail](#soft-fail) section for more details. |
|
|
342
342
|
| `--severity-threshold [INFO\|LOW\|MEDIUM\|HIGH\|CRITICAL]` | Show only violations at the specified level or higher. |
|
|
343
343
|
| `--sca-scan` | Specify the SCA scan you wish to execute (`package-vulnerabilities`/`license-compliance`). The default is both. |
|
|
344
344
|
| `--monitor` | When specified, the scan results will be recorded in the knowledge graph. Please note that when working in `monitor` mode, the knowledge graph will not be updated as a result of SCM events (Push, Repo creation). (Supported for SCA scan type only). |
|
|
345
|
-
| `--report`
|
|
345
|
+
| `--cycode-report` | When specified, displays a link to the scan report in the Cycode platform in the console output. |
|
|
346
346
|
| `--no-restore` | When specified, Cycode will not run restore command. Will scan direct dependencies ONLY! |
|
|
347
|
-
| `--sync` | Run scan synchronously (the default is asynchronous). |
|
|
348
347
|
| `--gradle-all-sub-projects` | When specified, Cycode will run gradle restore command for all sub projects. Should run from root project directory ONLY! |
|
|
349
348
|
| `--help` | Show options for given command. |
|
|
350
349
|
|
|
351
350
|
| Command | Description |
|
|
352
351
|
|----------------------------------------|-----------------------------------------------------------------|
|
|
353
|
-
| [
|
|
352
|
+
| [commit-history](#commit-history-scan) | Scan all the commits history in this git repository |
|
|
354
353
|
| [path](#path-scan) | Scan the files in the path supplied in the command |
|
|
355
|
-
| [
|
|
354
|
+
| [pre-commit](#pre-commit-scan) | Use this command to scan the content that was not committed yet |
|
|
356
355
|
| [repository](#repository-scan) | Scan git repository including its history |
|
|
357
356
|
|
|
358
357
|
### Options
|
|
@@ -381,18 +380,15 @@ When using this option, the scan results from this scan will appear in the knowl
|
|
|
381
380
|
> [!WARNING]
|
|
382
381
|
> You must be an `owner` or an `admin` in Cycode to view the knowledge graph page.
|
|
383
382
|
|
|
384
|
-
#### Report Option
|
|
383
|
+
#### Cycode Report Option
|
|
385
384
|
|
|
386
|
-
|
|
387
|
-
> This option is not available to IaC scans.
|
|
388
|
-
|
|
389
|
-
To push scan results tied to the [SCA policies](https://docs.cycode.com/docs/sca-policies) found in the Repository scan to Cycode, add the argument `--report` to the scan command.
|
|
385
|
+
For every scan performed using the Cycode CLI, a report is automatically generated and its results are sent to Cycode. These results are tied to the relevant policies (e.g., [SCA policies](https://docs.cycode.com/docs/sca-policies) for Repository scans) within the Cycode platform.
|
|
390
386
|
|
|
391
|
-
|
|
387
|
+
To have the direct URL to this Cycode report printed in your CLI output after the scan completes, add the argument `--cycode-report` to your scan command.
|
|
392
388
|
|
|
393
|
-
|
|
389
|
+
`cycode scan --cycode-report repository ~/home/git/codebase`
|
|
394
390
|
|
|
395
|
-
|
|
391
|
+
All scan results from the CLI will appear in the CLI Logs section of Cycode. If you included the `--cycode-report` flag in your command, a direct link to the specific report will be displayed in your terminal following the scan results.
|
|
396
392
|
|
|
397
393
|
> [!WARNING]
|
|
398
394
|
> You must be an `owner` or an `admin` in Cycode to view this page.
|
|
@@ -508,25 +504,25 @@ A commit history scan is limited to a local repository’s previous commits, foc
|
|
|
508
504
|
|
|
509
505
|
To execute a commit history scan, execute the following:
|
|
510
506
|
|
|
511
|
-
`cycode scan
|
|
507
|
+
`cycode scan commit-history {{path}}`
|
|
512
508
|
|
|
513
509
|
For example, consider a scenario in which you want to scan the commit history for a repository stored in `~/home/git/codebase`. You could then execute the following:
|
|
514
510
|
|
|
515
|
-
`cycode scan
|
|
511
|
+
`cycode scan commit-history ~/home/git/codebase`
|
|
516
512
|
|
|
517
513
|
The following options are available for use with this command:
|
|
518
514
|
|
|
519
515
|
| Option | Description |
|
|
520
516
|
|---------------------------|----------------------------------------------------------------------------------------------------------|
|
|
521
|
-
| `-r, --
|
|
517
|
+
| `-r, --commit-range TEXT` | Scan a commit range in this git repository, by default cycode scans all commit history (example: HEAD~1) |
|
|
522
518
|
|
|
523
519
|
#### Commit Range Option
|
|
524
520
|
|
|
525
|
-
The commit history scan, by default, examines the repository’s entire commit history, all the way back to the initial commit. You can instead limit the scan to a specific commit range by adding the argument `--
|
|
521
|
+
The commit history scan, by default, examines the repository’s entire commit history, all the way back to the initial commit. You can instead limit the scan to a specific commit range by adding the argument `--commit-range` (`-r`) followed by the name you specify.
|
|
526
522
|
|
|
527
523
|
Consider the previous example. If you wanted to scan only specific commits in your repository, you could execute the following:
|
|
528
524
|
|
|
529
|
-
`cycode scan
|
|
525
|
+
`cycode scan commit-history -r {{from-commit-id}}...{{to-commit-id}} ~/home/git/codebase`
|
|
530
526
|
|
|
531
527
|
### Pre-Commit Scan
|
|
532
528
|
|
|
@@ -865,7 +861,7 @@ The following commands are available for use with this command:
|
|
|
865
861
|
| Command | Description |
|
|
866
862
|
|------------------|-----------------------------------------------------------------|
|
|
867
863
|
| `path` | Generate SBOM report for provided path in the command |
|
|
868
|
-
| `
|
|
864
|
+
| `repository-url` | Generate SBOM report for provided repository URI in the command |
|
|
869
865
|
|
|
870
866
|
### Repository
|
|
871
867
|
|
|
@@ -21,7 +21,7 @@ This guide walks you through both installation and usage.
|
|
|
21
21
|
1. [Options](#options)
|
|
22
22
|
1. [Severity Threshold](#severity-option)
|
|
23
23
|
2. [Monitor](#monitor-option)
|
|
24
|
-
3. [Report](#report-option)
|
|
24
|
+
3. [Cycode Report](#cycode-report-option)
|
|
25
25
|
4. [Package Vulnerabilities](#package-vulnerabilities-option)
|
|
26
26
|
5. [License Compliance](#license-compliance-option)
|
|
27
27
|
6. [Lock Restore](#lock-restore-option)
|
|
@@ -54,7 +54,7 @@ This guide walks you through both installation and usage.
|
|
|
54
54
|
|
|
55
55
|
# Prerequisites
|
|
56
56
|
|
|
57
|
-
- The Cycode CLI application requires Python version 3.
|
|
57
|
+
- The Cycode CLI application requires Python version 3.9 or later.
|
|
58
58
|
- Use the [`cycode auth` command](#using-the-auth-command) to authenticate to Cycode with the CLI
|
|
59
59
|
- Alternatively, you can get a Cycode Client ID and Client Secret Key by following the steps detailed in the [Service Account Token](https://docs.cycode.com/docs/en/service-accounts) and [Personal Access Token](https://docs.cycode.com/v1/docs/managing-personal-access-tokens) pages, which contain details on getting these values.
|
|
60
60
|
|
|
@@ -208,7 +208,7 @@ Cycode’s pre-commit hook can be set up within your local repository so that th
|
|
|
208
208
|
|
|
209
209
|
Perform the following steps to install the pre-commit hook:
|
|
210
210
|
|
|
211
|
-
1. Install the pre-commit framework (Python 3.
|
|
211
|
+
1. Install the pre-commit framework (Python 3.9 or higher must be installed):
|
|
212
212
|
|
|
213
213
|
```bash
|
|
214
214
|
pip3 install pre-commit
|
|
@@ -221,11 +221,11 @@ Perform the following steps to install the pre-commit hook:
|
|
|
221
221
|
```yaml
|
|
222
222
|
repos:
|
|
223
223
|
- repo: https://github.com/cycodehq/cycode-cli
|
|
224
|
-
rev:
|
|
224
|
+
rev: v3.0.0
|
|
225
225
|
hooks:
|
|
226
226
|
- id: cycode
|
|
227
227
|
stages:
|
|
228
|
-
- commit
|
|
228
|
+
- pre-commit
|
|
229
229
|
```
|
|
230
230
|
|
|
231
231
|
4. Modify the created file for your specific needs. Use hook ID `cycode` to enable scan for Secrets. Use hook ID `cycode-sca` to enable SCA scan. If you want to enable both, use this configuration:
|
|
@@ -233,14 +233,14 @@ Perform the following steps to install the pre-commit hook:
|
|
|
233
233
|
```yaml
|
|
234
234
|
repos:
|
|
235
235
|
- repo: https://github.com/cycodehq/cycode-cli
|
|
236
|
-
rev:
|
|
236
|
+
rev: v3.0.0
|
|
237
237
|
hooks:
|
|
238
238
|
- id: cycode
|
|
239
239
|
stages:
|
|
240
|
-
- commit
|
|
240
|
+
- pre-commit
|
|
241
241
|
- id: cycode-sca
|
|
242
242
|
stages:
|
|
243
|
-
- commit
|
|
243
|
+
- pre-commit
|
|
244
244
|
```
|
|
245
245
|
|
|
246
246
|
5. Install Cycode’s hook:
|
|
@@ -281,8 +281,8 @@ The following are the options and commands available with the Cycode CLI applica
|
|
|
281
281
|
| [auth](#using-the-auth-command) | Authenticate your machine to associate the CLI with your Cycode account. |
|
|
282
282
|
| [configure](#using-the-configure-command) | Initial command to configure your CLI client authentication. |
|
|
283
283
|
| [ignore](#ignoring-scan-results) | Ignores a specific value, path or rule ID. |
|
|
284
|
-
| [scan](#running-a-scan) | Scan the content for Secrets/IaC/SCA/SAST violations. You`ll need to specify which scan type to perform:
|
|
285
|
-
| [report](#report-command) | Generate report. You`ll need to specify which report type to perform.
|
|
284
|
+
| [scan](#running-a-scan) | Scan the content for Secrets/IaC/SCA/SAST violations. You`ll need to specify which scan type to perform: commit-history/path/repository/etc. |
|
|
285
|
+
| [report](#report-command) | Generate report. You`ll need to specify which report type to perform as SBOM. |
|
|
286
286
|
| status | Show the CLI status and exit. |
|
|
287
287
|
|
|
288
288
|
# Scan Command
|
|
@@ -294,24 +294,23 @@ The Cycode CLI application offers several types of scans so that you can choose
|
|
|
294
294
|
| Option | Description |
|
|
295
295
|
|------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
296
296
|
| `-t, --scan-type [secret\|iac\|sca\|sast]` | Specify the scan you wish to execute (`secret`/`iac`/`sca`/`sast`), the default is `secret`. |
|
|
297
|
-
| `--secret TEXT`
|
|
297
|
+
| `--client-secret TEXT` | Specify a Cycode client secret for this specific scan execution. |
|
|
298
298
|
| `--client-id TEXT` | Specify a Cycode client ID for this specific scan execution. |
|
|
299
299
|
| `--show-secret BOOLEAN` | Show secrets in plain text. See [Show/Hide Secrets](#showhide-secrets) section for more details. |
|
|
300
300
|
| `--soft-fail BOOLEAN` | Run scan without failing, always return a non-error status code. See [Soft Fail](#soft-fail) section for more details. |
|
|
301
301
|
| `--severity-threshold [INFO\|LOW\|MEDIUM\|HIGH\|CRITICAL]` | Show only violations at the specified level or higher. |
|
|
302
302
|
| `--sca-scan` | Specify the SCA scan you wish to execute (`package-vulnerabilities`/`license-compliance`). The default is both. |
|
|
303
303
|
| `--monitor` | When specified, the scan results will be recorded in the knowledge graph. Please note that when working in `monitor` mode, the knowledge graph will not be updated as a result of SCM events (Push, Repo creation). (Supported for SCA scan type only). |
|
|
304
|
-
| `--report`
|
|
304
|
+
| `--cycode-report` | When specified, displays a link to the scan report in the Cycode platform in the console output. |
|
|
305
305
|
| `--no-restore` | When specified, Cycode will not run restore command. Will scan direct dependencies ONLY! |
|
|
306
|
-
| `--sync` | Run scan synchronously (the default is asynchronous). |
|
|
307
306
|
| `--gradle-all-sub-projects` | When specified, Cycode will run gradle restore command for all sub projects. Should run from root project directory ONLY! |
|
|
308
307
|
| `--help` | Show options for given command. |
|
|
309
308
|
|
|
310
309
|
| Command | Description |
|
|
311
310
|
|----------------------------------------|-----------------------------------------------------------------|
|
|
312
|
-
| [
|
|
311
|
+
| [commit-history](#commit-history-scan) | Scan all the commits history in this git repository |
|
|
313
312
|
| [path](#path-scan) | Scan the files in the path supplied in the command |
|
|
314
|
-
| [
|
|
313
|
+
| [pre-commit](#pre-commit-scan) | Use this command to scan the content that was not committed yet |
|
|
315
314
|
| [repository](#repository-scan) | Scan git repository including its history |
|
|
316
315
|
|
|
317
316
|
### Options
|
|
@@ -340,18 +339,15 @@ When using this option, the scan results from this scan will appear in the knowl
|
|
|
340
339
|
> [!WARNING]
|
|
341
340
|
> You must be an `owner` or an `admin` in Cycode to view the knowledge graph page.
|
|
342
341
|
|
|
343
|
-
#### Report Option
|
|
342
|
+
#### Cycode Report Option
|
|
344
343
|
|
|
345
|
-
|
|
346
|
-
> This option is not available to IaC scans.
|
|
347
|
-
|
|
348
|
-
To push scan results tied to the [SCA policies](https://docs.cycode.com/docs/sca-policies) found in the Repository scan to Cycode, add the argument `--report` to the scan command.
|
|
344
|
+
For every scan performed using the Cycode CLI, a report is automatically generated and its results are sent to Cycode. These results are tied to the relevant policies (e.g., [SCA policies](https://docs.cycode.com/docs/sca-policies) for Repository scans) within the Cycode platform.
|
|
349
345
|
|
|
350
|
-
|
|
346
|
+
To have the direct URL to this Cycode report printed in your CLI output after the scan completes, add the argument `--cycode-report` to your scan command.
|
|
351
347
|
|
|
352
|
-
|
|
348
|
+
`cycode scan --cycode-report repository ~/home/git/codebase`
|
|
353
349
|
|
|
354
|
-
|
|
350
|
+
All scan results from the CLI will appear in the CLI Logs section of Cycode. If you included the `--cycode-report` flag in your command, a direct link to the specific report will be displayed in your terminal following the scan results.
|
|
355
351
|
|
|
356
352
|
> [!WARNING]
|
|
357
353
|
> You must be an `owner` or an `admin` in Cycode to view this page.
|
|
@@ -467,25 +463,25 @@ A commit history scan is limited to a local repository’s previous commits, foc
|
|
|
467
463
|
|
|
468
464
|
To execute a commit history scan, execute the following:
|
|
469
465
|
|
|
470
|
-
`cycode scan
|
|
466
|
+
`cycode scan commit-history {{path}}`
|
|
471
467
|
|
|
472
468
|
For example, consider a scenario in which you want to scan the commit history for a repository stored in `~/home/git/codebase`. You could then execute the following:
|
|
473
469
|
|
|
474
|
-
`cycode scan
|
|
470
|
+
`cycode scan commit-history ~/home/git/codebase`
|
|
475
471
|
|
|
476
472
|
The following options are available for use with this command:
|
|
477
473
|
|
|
478
474
|
| Option | Description |
|
|
479
475
|
|---------------------------|----------------------------------------------------------------------------------------------------------|
|
|
480
|
-
| `-r, --
|
|
476
|
+
| `-r, --commit-range TEXT` | Scan a commit range in this git repository, by default cycode scans all commit history (example: HEAD~1) |
|
|
481
477
|
|
|
482
478
|
#### Commit Range Option
|
|
483
479
|
|
|
484
|
-
The commit history scan, by default, examines the repository’s entire commit history, all the way back to the initial commit. You can instead limit the scan to a specific commit range by adding the argument `--
|
|
480
|
+
The commit history scan, by default, examines the repository’s entire commit history, all the way back to the initial commit. You can instead limit the scan to a specific commit range by adding the argument `--commit-range` (`-r`) followed by the name you specify.
|
|
485
481
|
|
|
486
482
|
Consider the previous example. If you wanted to scan only specific commits in your repository, you could execute the following:
|
|
487
483
|
|
|
488
|
-
`cycode scan
|
|
484
|
+
`cycode scan commit-history -r {{from-commit-id}}...{{to-commit-id}} ~/home/git/codebase`
|
|
489
485
|
|
|
490
486
|
### Pre-Commit Scan
|
|
491
487
|
|
|
@@ -824,7 +820,7 @@ The following commands are available for use with this command:
|
|
|
824
820
|
| Command | Description |
|
|
825
821
|
|------------------|-----------------------------------------------------------------|
|
|
826
822
|
| `path` | Generate SBOM report for provided path in the command |
|
|
827
|
-
| `
|
|
823
|
+
| `repository-url` | Generate SBOM report for provided repository URI in the command |
|
|
828
824
|
|
|
829
825
|
### Repository
|
|
830
826
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '3.0.0' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from typing import Annotated, Optional
|
|
3
|
+
|
|
4
|
+
import typer
|
|
5
|
+
from typer import rich_utils
|
|
6
|
+
from typer._completion_classes import completion_init
|
|
7
|
+
from typer.completion import install_callback, show_callback
|
|
8
|
+
|
|
9
|
+
from cycode import __version__
|
|
10
|
+
from cycode.cli.apps import ai_remediation, auth, configure, ignore, report, scan, status
|
|
11
|
+
from cycode.cli.cli_types import OutputTypeOption
|
|
12
|
+
from cycode.cli.consts import CLI_CONTEXT_SETTINGS
|
|
13
|
+
from cycode.cli.printers import ConsolePrinter
|
|
14
|
+
from cycode.cli.user_settings.configuration_manager import ConfigurationManager
|
|
15
|
+
from cycode.cli.utils.progress_bar import SCAN_PROGRESS_BAR_SECTIONS, get_progress_bar
|
|
16
|
+
from cycode.cli.utils.sentry import add_breadcrumb, init_sentry
|
|
17
|
+
from cycode.cli.utils.version_checker import version_checker
|
|
18
|
+
from cycode.cyclient.cycode_client_base import CycodeClientBase
|
|
19
|
+
from cycode.cyclient.models import UserAgentOptionScheme
|
|
20
|
+
from cycode.logger import set_logging_level
|
|
21
|
+
|
|
22
|
+
# By default, it uses dim style which is hard to read with the combination of color from RICH_HELP
|
|
23
|
+
rich_utils.STYLE_ERRORS_SUGGESTION = 'bold'
|
|
24
|
+
# By default, it uses blue color which is too dark for some terminals
|
|
25
|
+
rich_utils.RICH_HELP = "Try [cyan]'{command_path} {help_option}'[/] for help."
|
|
26
|
+
|
|
27
|
+
completion_init() # DO NOT TOUCH; this is required for the completion to work properly
|
|
28
|
+
|
|
29
|
+
_cycode_cli_docs = 'https://github.com/cycodehq/cycode-cli/blob/main/README.md'
|
|
30
|
+
_cycode_cli_epilog = f'[bold]Documentation:[/] [link={_cycode_cli_docs}]{_cycode_cli_docs}[/link]'
|
|
31
|
+
|
|
32
|
+
app = typer.Typer(
|
|
33
|
+
pretty_exceptions_show_locals=False,
|
|
34
|
+
pretty_exceptions_short=True,
|
|
35
|
+
context_settings=CLI_CONTEXT_SETTINGS,
|
|
36
|
+
epilog=_cycode_cli_epilog,
|
|
37
|
+
rich_markup_mode='rich',
|
|
38
|
+
no_args_is_help=True,
|
|
39
|
+
add_completion=False, # we add it manually to control the rich help panel
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
app.add_typer(ai_remediation.app)
|
|
43
|
+
app.add_typer(auth.app)
|
|
44
|
+
app.add_typer(configure.app)
|
|
45
|
+
app.add_typer(ignore.app)
|
|
46
|
+
app.add_typer(report.app)
|
|
47
|
+
app.add_typer(scan.app)
|
|
48
|
+
app.add_typer(status.app)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def check_latest_version_on_close(ctx: typer.Context) -> None:
|
|
52
|
+
output = ctx.obj.get('output')
|
|
53
|
+
# don't print anything if the output is JSON
|
|
54
|
+
if output == OutputTypeOption.JSON:
|
|
55
|
+
return
|
|
56
|
+
|
|
57
|
+
# we always want to check the latest version for "version" and "status" commands
|
|
58
|
+
should_use_cache = ctx.invoked_subcommand not in {'version', 'status'}
|
|
59
|
+
version_checker.check_and_notify_update(current_version=__version__, use_cache=should_use_cache)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def export_if_needed_on_close(ctx: typer.Context) -> None:
|
|
63
|
+
scan_finalized = ctx.obj.get('scan_finalized')
|
|
64
|
+
printer = ctx.obj.get('console_printer')
|
|
65
|
+
if scan_finalized and printer.is_recording:
|
|
66
|
+
printer.export()
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
_AUTH_RICH_HELP_PANEL = 'Authentication options'
|
|
70
|
+
_COMPLETION_RICH_HELP_PANEL = 'Completion options'
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@app.callback()
|
|
74
|
+
def app_callback(
|
|
75
|
+
ctx: typer.Context,
|
|
76
|
+
verbose: Annotated[bool, typer.Option('--verbose', '-v', help='Show detailed logs.')] = False,
|
|
77
|
+
no_progress_meter: Annotated[
|
|
78
|
+
bool, typer.Option('--no-progress-meter', help='Do not show the progress meter.')
|
|
79
|
+
] = False,
|
|
80
|
+
no_update_notifier: Annotated[
|
|
81
|
+
bool, typer.Option('--no-update-notifier', help='Do not check CLI for updates.')
|
|
82
|
+
] = False,
|
|
83
|
+
output: Annotated[
|
|
84
|
+
OutputTypeOption, typer.Option('--output', '-o', case_sensitive=False, help='Specify the output type.')
|
|
85
|
+
] = OutputTypeOption.RICH,
|
|
86
|
+
user_agent: Annotated[
|
|
87
|
+
Optional[str],
|
|
88
|
+
typer.Option(hidden=True, help='Characteristic JSON object that lets servers identify the application.'),
|
|
89
|
+
] = None,
|
|
90
|
+
client_secret: Annotated[
|
|
91
|
+
Optional[str],
|
|
92
|
+
typer.Option(
|
|
93
|
+
help='Specify a Cycode client secret for this specific scan execution.',
|
|
94
|
+
rich_help_panel=_AUTH_RICH_HELP_PANEL,
|
|
95
|
+
),
|
|
96
|
+
] = None,
|
|
97
|
+
client_id: Annotated[
|
|
98
|
+
Optional[str],
|
|
99
|
+
typer.Option(
|
|
100
|
+
help='Specify a Cycode client ID for this specific scan execution.',
|
|
101
|
+
rich_help_panel=_AUTH_RICH_HELP_PANEL,
|
|
102
|
+
),
|
|
103
|
+
] = None,
|
|
104
|
+
_: Annotated[
|
|
105
|
+
Optional[bool],
|
|
106
|
+
typer.Option(
|
|
107
|
+
'--install-completion',
|
|
108
|
+
callback=install_callback,
|
|
109
|
+
is_eager=True,
|
|
110
|
+
expose_value=False,
|
|
111
|
+
help='Install completion for the current shell.',
|
|
112
|
+
rich_help_panel=_COMPLETION_RICH_HELP_PANEL,
|
|
113
|
+
),
|
|
114
|
+
] = False,
|
|
115
|
+
__: Annotated[
|
|
116
|
+
Optional[bool],
|
|
117
|
+
typer.Option(
|
|
118
|
+
'--show-completion',
|
|
119
|
+
callback=show_callback,
|
|
120
|
+
is_eager=True,
|
|
121
|
+
expose_value=False,
|
|
122
|
+
help='Show completion for the current shell, to copy it or customize the installation.',
|
|
123
|
+
rich_help_panel=_COMPLETION_RICH_HELP_PANEL,
|
|
124
|
+
),
|
|
125
|
+
] = False,
|
|
126
|
+
) -> None:
|
|
127
|
+
"""[bold cyan]Cycode CLI - Command Line Interface for Cycode.[/]"""
|
|
128
|
+
init_sentry()
|
|
129
|
+
add_breadcrumb('cycode')
|
|
130
|
+
|
|
131
|
+
ctx.ensure_object(dict)
|
|
132
|
+
configuration_manager = ConfigurationManager()
|
|
133
|
+
|
|
134
|
+
verbose = verbose or configuration_manager.get_verbose_flag()
|
|
135
|
+
ctx.obj['verbose'] = verbose
|
|
136
|
+
if verbose:
|
|
137
|
+
set_logging_level(logging.DEBUG)
|
|
138
|
+
|
|
139
|
+
ctx.obj['output'] = output
|
|
140
|
+
if output == OutputTypeOption.JSON:
|
|
141
|
+
no_progress_meter = True
|
|
142
|
+
|
|
143
|
+
ctx.obj['client_id'] = client_id
|
|
144
|
+
ctx.obj['client_secret'] = client_secret
|
|
145
|
+
|
|
146
|
+
ctx.obj['progress_bar'] = get_progress_bar(hidden=no_progress_meter, sections=SCAN_PROGRESS_BAR_SECTIONS)
|
|
147
|
+
|
|
148
|
+
ctx.obj['console_printer'] = ConsolePrinter(ctx)
|
|
149
|
+
ctx.call_on_close(lambda: export_if_needed_on_close(ctx))
|
|
150
|
+
|
|
151
|
+
if user_agent:
|
|
152
|
+
user_agent_option = UserAgentOptionScheme().loads(user_agent)
|
|
153
|
+
CycodeClientBase.enrich_user_agent(user_agent_option.user_agent_suffix)
|
|
154
|
+
|
|
155
|
+
if not no_update_notifier:
|
|
156
|
+
ctx.call_on_close(lambda: check_latest_version_on_close(ctx))
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
|
|
3
|
+
from cycode.cli.apps.ai_remediation.ai_remediation_command import ai_remediation_command
|
|
4
|
+
|
|
5
|
+
app = typer.Typer()
|
|
6
|
+
|
|
7
|
+
_ai_remediation_epilog = (
|
|
8
|
+
'Note: AI remediation suggestions are generated automatically and should be reviewed before applying.'
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
app.command(
|
|
12
|
+
name='ai-remediation',
|
|
13
|
+
short_help='Get AI remediation (INTERNAL).',
|
|
14
|
+
epilog=_ai_remediation_epilog,
|
|
15
|
+
hidden=True,
|
|
16
|
+
no_args_is_help=True,
|
|
17
|
+
)(ai_remediation_command)
|
|
18
|
+
|
|
19
|
+
# backward compatibility
|
|
20
|
+
app.command(hidden=True, name='ai_remediation')(ai_remediation_command)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from typing import Annotated
|
|
2
|
+
from uuid import UUID
|
|
3
|
+
|
|
4
|
+
import typer
|
|
5
|
+
|
|
6
|
+
from cycode.cli.apps.ai_remediation.apply_fix import apply_fix
|
|
7
|
+
from cycode.cli.apps.ai_remediation.print_remediation import print_remediation
|
|
8
|
+
from cycode.cli.exceptions.handle_ai_remediation_errors import handle_ai_remediation_exception
|
|
9
|
+
from cycode.cli.utils.get_api_client import get_scan_cycode_client
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def ai_remediation_command(
|
|
13
|
+
ctx: typer.Context,
|
|
14
|
+
detection_id: Annotated[UUID, typer.Argument(help='Detection ID to get remediation for', show_default=False)],
|
|
15
|
+
fix: Annotated[
|
|
16
|
+
bool, typer.Option('--fix', help='Apply fixes to resolve violations. Note: fix could be not available.')
|
|
17
|
+
] = False,
|
|
18
|
+
) -> None:
|
|
19
|
+
""":robot: [bold cyan]Get AI-powered remediation for security issues.[/]
|
|
20
|
+
|
|
21
|
+
This command provides AI-generated remediation guidance for detected security issues.
|
|
22
|
+
|
|
23
|
+
Example usage:
|
|
24
|
+
* `cycode ai-remediation <detection_id>`: View remediation guidance
|
|
25
|
+
* `cycode ai-remediation <detection_id> --fix`: Apply suggested fixes
|
|
26
|
+
"""
|
|
27
|
+
client = get_scan_cycode_client(ctx)
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
remediation_markdown = client.get_ai_remediation(detection_id)
|
|
31
|
+
fix_diff = client.get_ai_remediation(detection_id, fix=True)
|
|
32
|
+
is_fix_available = bool(fix_diff) # exclude empty string, None, etc.
|
|
33
|
+
|
|
34
|
+
if fix:
|
|
35
|
+
apply_fix(ctx, fix_diff, is_fix_available)
|
|
36
|
+
else:
|
|
37
|
+
print_remediation(ctx, remediation_markdown, is_fix_available)
|
|
38
|
+
except Exception as err:
|
|
39
|
+
handle_ai_remediation_exception(ctx, err)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import typer
|
|
4
|
+
from patch_ng import fromstring
|
|
5
|
+
|
|
6
|
+
from cycode.cli.models import CliResult
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def apply_fix(ctx: typer.Context, diff: str, is_fix_available: bool) -> None:
|
|
10
|
+
printer = ctx.obj.get('console_printer')
|
|
11
|
+
if not is_fix_available:
|
|
12
|
+
printer.print_result(CliResult(success=False, message='Fix is not available for this violation'))
|
|
13
|
+
return
|
|
14
|
+
|
|
15
|
+
patch = fromstring(diff.encode('UTF-8'))
|
|
16
|
+
if patch is False:
|
|
17
|
+
printer.print_result(CliResult(success=False, message='Failed to parse fix diff'))
|
|
18
|
+
return
|
|
19
|
+
|
|
20
|
+
is_fix_applied = patch.apply(root=os.getcwd(), strip=0)
|
|
21
|
+
if is_fix_applied:
|
|
22
|
+
printer.print_result(CliResult(success=True, message='Fix applied successfully'))
|
|
23
|
+
else:
|
|
24
|
+
printer.print_result(CliResult(success=False, message='Failed to apply fix'))
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
from rich.markdown import Markdown
|
|
3
|
+
|
|
4
|
+
from cycode.cli.console import console
|
|
5
|
+
from cycode.cli.models import CliResult
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def print_remediation(ctx: typer.Context, remediation_markdown: str, is_fix_available: bool) -> None:
|
|
9
|
+
printer = ctx.obj.get('console_printer')
|
|
10
|
+
if printer.is_json_printer:
|
|
11
|
+
data = {'remediation': remediation_markdown, 'is_fix_available': is_fix_available}
|
|
12
|
+
printer.print_result(CliResult(success=True, message='Remediation fetched successfully', data=data))
|
|
13
|
+
else: # text or table
|
|
14
|
+
console.print(Markdown(remediation_markdown))
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
|
|
3
|
+
from cycode.cli.apps.auth.auth_command import auth_command
|
|
4
|
+
|
|
5
|
+
_auth_command_docs = 'https://github.com/cycodehq/cycode-cli/blob/main/README.md#using-the-auth-command'
|
|
6
|
+
_auth_command_epilog = f'[bold]Documentation:[/] [link={_auth_command_docs}]{_auth_command_docs}[/link]'
|
|
7
|
+
|
|
8
|
+
app = typer.Typer(no_args_is_help=False)
|
|
9
|
+
app.command(name='auth', epilog=_auth_command_epilog, short_help='Authenticate your machine with Cycode.')(auth_command)
|