cycode 1.11.1.dev5__tar.gz → 1.11.1.dev9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cycode-1.11.1.dev9/LICENCE +21 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/PKG-INFO +47 -8
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/README.md +45 -6
- cycode-1.11.1.dev9/cycode/__init__.py +1 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/repository/repository_command.py +9 -2
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/sca/base_restore_dependencies.py +15 -3
- cycode-1.11.1.dev9/cycode/cli/files_collector/sca/go/restore_go_dependencies.py +31 -0
- cycode-1.11.1.dev9/cycode/cli/files_collector/sca/sbt/restore_sbt_dependencies.py +25 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/sca/sca_code_scanner.py +5 -9
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/models.py +7 -1
- cycode-1.11.1.dev9/cycode/cli/user_settings/__init__.py +0 -0
- cycode-1.11.1.dev9/cycode/cli/utils/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/utils/shell_executor.py +6 -2
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/pyproject.toml +1 -1
- cycode-1.11.1.dev5/cycode/__init__.py +0 -1
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/auth/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/auth/auth_command.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/auth/auth_manager.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/configure/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/configure/configure_command.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/ignore/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/ignore/ignore_command.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/main_cli.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/report/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/report/report_command.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/report/sbom/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/report/sbom/common.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/report/sbom/path/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/report/sbom/path/path_command.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/report/sbom/repository_url/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/report/sbom/repository_url/repository_url_command.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/report/sbom/sbom_command.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/report/sbom/sbom_report_file.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/code_scanner.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/commit_history/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/commit_history/commit_history_command.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/path/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/path/path_command.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/pre_commit/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/pre_commit/pre_commit_command.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/pre_receive/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/pre_receive/pre_receive_command.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/repository/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/scan_ci/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/scan_ci/ci_integrations.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/scan_ci/scan_ci_command.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/scan_command.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/version/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/version/version_command.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/config.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/config.yaml +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/consts.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/exceptions/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/exceptions/custom_exceptions.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/exceptions/handle_report_sbom_errors.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/exceptions/handle_scan_errors.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/excluder.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/iac/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/iac/tf_content_generator.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/models/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/models/in_memory_zip.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/path_documents.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/repository_documents.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/sca/__init__.py +0 -0
- {cycode-1.11.1.dev5/cycode/cli/files_collector/sca/maven → cycode-1.11.1.dev9/cycode/cli/files_collector/sca/go}/__init__.py +0 -0
- {cycode-1.11.1.dev5/cycode/cli/files_collector/sca/npm → cycode-1.11.1.dev9/cycode/cli/files_collector/sca/maven}/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/sca/maven/restore_gradle_dependencies.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/sca/maven/restore_maven_dependencies.py +0 -0
- {cycode-1.11.1.dev5/cycode/cli/files_collector/sca/nuget → cycode-1.11.1.dev9/cycode/cli/files_collector/sca/npm}/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/sca/npm/restore_npm_dependencies.py +0 -0
- {cycode-1.11.1.dev5/cycode/cli/printers/tables → cycode-1.11.1.dev9/cycode/cli/files_collector/sca/nuget}/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/sca/nuget/restore_nuget_dependencies.py +0 -0
- {cycode-1.11.1.dev5/cycode/cli/user_settings → cycode-1.11.1.dev9/cycode/cli/files_collector/sca/sbt}/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/zip_documents.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/main.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/printers/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/printers/console_printer.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/printers/json_printer.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/printers/printer_base.py +0 -0
- {cycode-1.11.1.dev5/cycode/cli/utils → cycode-1.11.1.dev9/cycode/cli/printers/tables}/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/printers/tables/sca_table_printer.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/printers/tables/table.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/printers/tables/table_models.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/printers/tables/table_printer.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/printers/tables/table_printer_base.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/printers/text_printer.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/sentry.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/user_settings/base_file_manager.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/user_settings/config_file_manager.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/user_settings/configuration_manager.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/user_settings/credentials_manager.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/user_settings/jwt_creator.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/utils/enum_utils.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/utils/get_api_client.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/utils/git_proxy.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/utils/jwt_utils.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/utils/path_utils.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/utils/progress_bar.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/utils/scan_batch.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/utils/scan_utils.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/utils/string_utils.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/utils/task_timer.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/utils/yaml_utils.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cyclient/__init__.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cyclient/auth_client.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cyclient/client_creator.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cyclient/config.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cyclient/config.yaml +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cyclient/config_dev.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cyclient/cycode_client.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cyclient/cycode_client_base.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cyclient/cycode_dev_based_client.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cyclient/cycode_token_based_client.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cyclient/headers.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cyclient/models.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cyclient/report_client.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cyclient/scan_client.py +0 -0
- {cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cyclient/scan_config_base.py +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Cycode Ltd.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cycode
|
|
3
|
-
Version: 1.11.1.
|
|
3
|
+
Version: 1.11.1.dev9
|
|
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
|
|
@@ -19,8 +19,8 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.9
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
24
24
|
Classifier: Programming Language :: Python :: 3.13
|
|
25
25
|
Requires-Dist: arrow (>=1.0.0,<1.4.0)
|
|
26
26
|
Requires-Dist: binaryornot (>=0.4.4,<0.5.0)
|
|
@@ -70,6 +70,8 @@ This guide will guide you through both installation and usage.
|
|
|
70
70
|
6. [Commit History Scan](#commit-history-scan)
|
|
71
71
|
1. [Commit Range Option](#commit-range-option)
|
|
72
72
|
7. [Pre-Commit Scan](#pre-commit-scan)
|
|
73
|
+
8. [Lock Restore Options](#lock-restore-options)
|
|
74
|
+
1. [SBT Scan](#sbt-scan)
|
|
73
75
|
2. [Scan Results](#scan-results)
|
|
74
76
|
1. [Show/Hide Secrets](#showhide-secrets)
|
|
75
77
|
2. [Soft Fail](#soft-fail)
|
|
@@ -239,33 +241,59 @@ export CYCODE_CLIENT_SECRET={your Cycode Secret Key}
|
|
|
239
241
|
|
|
240
242
|
Cycode’s pre-commit hook can be set up within your local repository so that the Cycode CLI application will identify any issues with your code automatically before you commit it to your codebase.
|
|
241
243
|
|
|
244
|
+
> [!NOTE]
|
|
245
|
+
> pre-commit hook is only available to Secrets and SCA scans.
|
|
246
|
+
|
|
242
247
|
Perform the following steps to install the pre-commit hook:
|
|
243
248
|
|
|
244
|
-
1. Install the pre-commit framework:
|
|
249
|
+
1. Install the pre-commit framework (Python 3.8 or higher must be installed):
|
|
245
250
|
|
|
246
251
|
`pip3 install pre-commit`
|
|
247
252
|
|
|
248
|
-
2. Navigate to the top directory of the local repository you wish to
|
|
253
|
+
2. Navigate to the top directory of the local Git repository you wish to configure.
|
|
249
254
|
|
|
250
255
|
3. Create a new YAML file named `.pre-commit-config.yaml` (include the beginning `.`) in the repository’s top directory that contains the following:
|
|
251
256
|
|
|
252
257
|
```yaml
|
|
253
258
|
repos:
|
|
254
259
|
- repo: https://github.com/cycodehq/cycode-cli
|
|
255
|
-
rev: v1.
|
|
260
|
+
rev: v1.11.0
|
|
261
|
+
hooks:
|
|
262
|
+
- id: cycode
|
|
263
|
+
stages:
|
|
264
|
+
- commit
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
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:
|
|
268
|
+
|
|
269
|
+
```yaml
|
|
270
|
+
repos:
|
|
271
|
+
- repo: https://github.com/cycodehq/cycode-cli
|
|
272
|
+
rev: v1.11.0
|
|
256
273
|
hooks:
|
|
257
274
|
- id: cycode
|
|
258
275
|
stages:
|
|
259
276
|
- commit
|
|
277
|
+
- id: cycode-sca
|
|
278
|
+
stages:
|
|
279
|
+
- commit
|
|
260
280
|
```
|
|
261
281
|
|
|
262
|
-
|
|
282
|
+
5. Install Cycode’s hook:
|
|
263
283
|
|
|
264
284
|
`pre-commit install`
|
|
265
285
|
|
|
286
|
+
A successful hook installation will result in the message: `Pre-commit installed at .git/hooks/pre-commit`.
|
|
287
|
+
|
|
288
|
+
6. Keep the pre-commit hook up to date:
|
|
289
|
+
|
|
290
|
+
`pre-commit autoupdate`
|
|
291
|
+
|
|
292
|
+
It will automatically bump "rev" in ".pre-commit-config.yaml" to the latest available version of Cycode CLI.
|
|
293
|
+
|
|
266
294
|
> [!NOTE]
|
|
267
|
-
>
|
|
268
|
-
|
|
295
|
+
> Trigger happens on `git commit` command.
|
|
296
|
+
> Hook triggers only on the files that are staged for commit.
|
|
269
297
|
|
|
270
298
|
# Cycode CLI Commands
|
|
271
299
|
|
|
@@ -510,6 +538,17 @@ After your install the pre-commit hook and, you may, on occasion, wish to skip s
|
|
|
510
538
|
|
|
511
539
|
`SKIP=cycode git commit -m <your commit message>`
|
|
512
540
|
|
|
541
|
+
### Lock Restore Options
|
|
542
|
+
|
|
543
|
+
#### SBT Scan
|
|
544
|
+
|
|
545
|
+
We use sbt-dependency-lock plugin to restore the lock file for SBT projects.
|
|
546
|
+
To disable lock restore in use `--no-restore` option.
|
|
547
|
+
|
|
548
|
+
Prerequisites
|
|
549
|
+
* sbt-dependency-lock Plugin: Install the plugin by adding the following line to `project/plugins.sbt`:
|
|
550
|
+
`addSbtPlugin("software.purpledragon" % "sbt-dependency-lock" % "1.5.1")`
|
|
551
|
+
|
|
513
552
|
## Scan Results
|
|
514
553
|
|
|
515
554
|
Each scan will complete with a message stating if any issues were found or not.
|
|
@@ -30,6 +30,8 @@ This guide will guide you through both installation and usage.
|
|
|
30
30
|
6. [Commit History Scan](#commit-history-scan)
|
|
31
31
|
1. [Commit Range Option](#commit-range-option)
|
|
32
32
|
7. [Pre-Commit Scan](#pre-commit-scan)
|
|
33
|
+
8. [Lock Restore Options](#lock-restore-options)
|
|
34
|
+
1. [SBT Scan](#sbt-scan)
|
|
33
35
|
2. [Scan Results](#scan-results)
|
|
34
36
|
1. [Show/Hide Secrets](#showhide-secrets)
|
|
35
37
|
2. [Soft Fail](#soft-fail)
|
|
@@ -199,33 +201,59 @@ export CYCODE_CLIENT_SECRET={your Cycode Secret Key}
|
|
|
199
201
|
|
|
200
202
|
Cycode’s pre-commit hook can be set up within your local repository so that the Cycode CLI application will identify any issues with your code automatically before you commit it to your codebase.
|
|
201
203
|
|
|
204
|
+
> [!NOTE]
|
|
205
|
+
> pre-commit hook is only available to Secrets and SCA scans.
|
|
206
|
+
|
|
202
207
|
Perform the following steps to install the pre-commit hook:
|
|
203
208
|
|
|
204
|
-
1. Install the pre-commit framework:
|
|
209
|
+
1. Install the pre-commit framework (Python 3.8 or higher must be installed):
|
|
205
210
|
|
|
206
211
|
`pip3 install pre-commit`
|
|
207
212
|
|
|
208
|
-
2. Navigate to the top directory of the local repository you wish to
|
|
213
|
+
2. Navigate to the top directory of the local Git repository you wish to configure.
|
|
209
214
|
|
|
210
215
|
3. Create a new YAML file named `.pre-commit-config.yaml` (include the beginning `.`) in the repository’s top directory that contains the following:
|
|
211
216
|
|
|
212
217
|
```yaml
|
|
213
218
|
repos:
|
|
214
219
|
- repo: https://github.com/cycodehq/cycode-cli
|
|
215
|
-
rev: v1.
|
|
220
|
+
rev: v1.11.0
|
|
221
|
+
hooks:
|
|
222
|
+
- id: cycode
|
|
223
|
+
stages:
|
|
224
|
+
- commit
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
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:
|
|
228
|
+
|
|
229
|
+
```yaml
|
|
230
|
+
repos:
|
|
231
|
+
- repo: https://github.com/cycodehq/cycode-cli
|
|
232
|
+
rev: v1.11.0
|
|
216
233
|
hooks:
|
|
217
234
|
- id: cycode
|
|
218
235
|
stages:
|
|
219
236
|
- commit
|
|
237
|
+
- id: cycode-sca
|
|
238
|
+
stages:
|
|
239
|
+
- commit
|
|
220
240
|
```
|
|
221
241
|
|
|
222
|
-
|
|
242
|
+
5. Install Cycode’s hook:
|
|
223
243
|
|
|
224
244
|
`pre-commit install`
|
|
225
245
|
|
|
246
|
+
A successful hook installation will result in the message: `Pre-commit installed at .git/hooks/pre-commit`.
|
|
247
|
+
|
|
248
|
+
6. Keep the pre-commit hook up to date:
|
|
249
|
+
|
|
250
|
+
`pre-commit autoupdate`
|
|
251
|
+
|
|
252
|
+
It will automatically bump "rev" in ".pre-commit-config.yaml" to the latest available version of Cycode CLI.
|
|
253
|
+
|
|
226
254
|
> [!NOTE]
|
|
227
|
-
>
|
|
228
|
-
|
|
255
|
+
> Trigger happens on `git commit` command.
|
|
256
|
+
> Hook triggers only on the files that are staged for commit.
|
|
229
257
|
|
|
230
258
|
# Cycode CLI Commands
|
|
231
259
|
|
|
@@ -470,6 +498,17 @@ After your install the pre-commit hook and, you may, on occasion, wish to skip s
|
|
|
470
498
|
|
|
471
499
|
`SKIP=cycode git commit -m <your commit message>`
|
|
472
500
|
|
|
501
|
+
### Lock Restore Options
|
|
502
|
+
|
|
503
|
+
#### SBT Scan
|
|
504
|
+
|
|
505
|
+
We use sbt-dependency-lock plugin to restore the lock file for SBT projects.
|
|
506
|
+
To disable lock restore in use `--no-restore` option.
|
|
507
|
+
|
|
508
|
+
Prerequisites
|
|
509
|
+
* sbt-dependency-lock Plugin: Install the plugin by adding the following line to `project/plugins.sbt`:
|
|
510
|
+
`addSbtPlugin("software.purpledragon" % "sbt-dependency-lock" % "1.5.1")`
|
|
511
|
+
|
|
473
512
|
## Scan Results
|
|
474
513
|
|
|
475
514
|
Each scan will complete with a message stating if any issues were found or not.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '1.11.1.dev9' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
|
{cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/repository/repository_command.py
RENAMED
|
@@ -48,8 +48,15 @@ def repository_command(context: click.Context, path: str, branch: str) -> None:
|
|
|
48
48
|
# FIXME(MarshalX): probably file could be tree or submodule too. we expect blob only
|
|
49
49
|
progress_bar.update(ScanProgressBarSection.PREPARE_LOCAL_FILES)
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
absolute_path = get_path_by_os(os.path.join(path, file.path))
|
|
52
|
+
file_path = file.path if monitor else absolute_path
|
|
53
|
+
documents_to_scan.append(
|
|
54
|
+
Document(
|
|
55
|
+
file_path,
|
|
56
|
+
file.data_stream.read().decode('UTF-8', errors='replace'),
|
|
57
|
+
absolute_path=absolute_path,
|
|
58
|
+
)
|
|
59
|
+
)
|
|
53
60
|
|
|
54
61
|
documents_to_scan = exclude_irrelevant_documents_to_scan(scan_type, documents_to_scan)
|
|
55
62
|
|
|
@@ -14,10 +14,14 @@ def build_dep_tree_path(path: str, generated_file_name: str) -> str:
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def execute_command(
|
|
17
|
-
command: List[str],
|
|
17
|
+
command: List[str],
|
|
18
|
+
file_name: str,
|
|
19
|
+
command_timeout: int,
|
|
20
|
+
dependencies_file_name: Optional[str] = None,
|
|
21
|
+
working_directory: Optional[str] = None,
|
|
18
22
|
) -> Optional[str]:
|
|
19
23
|
try:
|
|
20
|
-
dependencies = shell(command=command, timeout=command_timeout)
|
|
24
|
+
dependencies = shell(command=command, timeout=command_timeout, working_directory=working_directory)
|
|
21
25
|
# Write stdout output to the file if output_file_path is provided
|
|
22
26
|
if dependencies_file_name:
|
|
23
27
|
with open(dependencies_file_name, 'w') as output_file:
|
|
@@ -51,18 +55,26 @@ class BaseRestoreDependencies(ABC):
|
|
|
51
55
|
def try_restore_dependencies(self, document: Document) -> Optional[Document]:
|
|
52
56
|
manifest_file_path = self.get_manifest_file_path(document)
|
|
53
57
|
restore_file_path = build_dep_tree_path(document.path, self.get_lock_file_name())
|
|
58
|
+
working_directory_path = self.get_working_directory(document)
|
|
54
59
|
|
|
55
60
|
if self.verify_restore_file_already_exist(restore_file_path):
|
|
56
61
|
restore_file_content = get_file_content(restore_file_path)
|
|
57
62
|
else:
|
|
58
63
|
output_file_path = restore_file_path if self.create_output_file_manually else None
|
|
59
64
|
execute_command(
|
|
60
|
-
self.get_command(manifest_file_path),
|
|
65
|
+
self.get_command(manifest_file_path),
|
|
66
|
+
manifest_file_path,
|
|
67
|
+
self.command_timeout,
|
|
68
|
+
output_file_path,
|
|
69
|
+
working_directory_path,
|
|
61
70
|
)
|
|
62
71
|
restore_file_content = get_file_content(restore_file_path)
|
|
63
72
|
|
|
64
73
|
return Document(restore_file_path, restore_file_content, self.is_git_diff)
|
|
65
74
|
|
|
75
|
+
def get_working_directory(self, document: Document) -> Optional[str]:
|
|
76
|
+
return None
|
|
77
|
+
|
|
66
78
|
@abstractmethod
|
|
67
79
|
def verify_restore_file_already_exist(self, restore_file_path: str) -> bool:
|
|
68
80
|
pass
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from typing import List
|
|
3
|
+
|
|
4
|
+
import click
|
|
5
|
+
|
|
6
|
+
from cycode.cli.files_collector.sca.base_restore_dependencies import BaseRestoreDependencies
|
|
7
|
+
from cycode.cli.models import Document
|
|
8
|
+
|
|
9
|
+
GO_PROJECT_FILE_EXTENSIONS = ['.mod']
|
|
10
|
+
GO_RESTORE_FILE_NAME = 'go.sum'
|
|
11
|
+
BUILD_GO_FILE_NAME = 'go.mod'
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class RestoreGoDependencies(BaseRestoreDependencies):
|
|
15
|
+
def __init__(self, context: click.Context, is_git_diff: bool, command_timeout: int) -> None:
|
|
16
|
+
super().__init__(context, is_git_diff, command_timeout, create_output_file_manually=True)
|
|
17
|
+
|
|
18
|
+
def is_project(self, document: Document) -> bool:
|
|
19
|
+
return any(document.path.endswith(ext) for ext in GO_PROJECT_FILE_EXTENSIONS)
|
|
20
|
+
|
|
21
|
+
def get_command(self, manifest_file_path: str) -> List[str]:
|
|
22
|
+
return ['cd', self.prepare_tree_file_path_for_command(manifest_file_path), '&&', 'go', 'list', '-m', '-json']
|
|
23
|
+
|
|
24
|
+
def get_lock_file_name(self) -> str:
|
|
25
|
+
return GO_RESTORE_FILE_NAME
|
|
26
|
+
|
|
27
|
+
def verify_restore_file_already_exist(self, restore_file_path: str) -> bool:
|
|
28
|
+
return os.path.isfile(restore_file_path)
|
|
29
|
+
|
|
30
|
+
def prepare_tree_file_path_for_command(self, manifest_file_path: str) -> str:
|
|
31
|
+
return manifest_file_path.replace(os.sep + BUILD_GO_FILE_NAME, '')
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
|
|
4
|
+
from cycode.cli.files_collector.sca.base_restore_dependencies import BaseRestoreDependencies
|
|
5
|
+
from cycode.cli.models import Document
|
|
6
|
+
|
|
7
|
+
SBT_PROJECT_FILE_EXTENSIONS = ['sbt']
|
|
8
|
+
SBT_LOCK_FILE_NAME = 'build.sbt.lock'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class RestoreSbtDependencies(BaseRestoreDependencies):
|
|
12
|
+
def is_project(self, document: Document) -> bool:
|
|
13
|
+
return any(document.path.endswith(ext) for ext in SBT_PROJECT_FILE_EXTENSIONS)
|
|
14
|
+
|
|
15
|
+
def get_command(self, manifest_file_path: str) -> List[str]:
|
|
16
|
+
return ['sbt', 'dependencyLockWrite', '--verbose']
|
|
17
|
+
|
|
18
|
+
def get_lock_file_name(self) -> str:
|
|
19
|
+
return SBT_LOCK_FILE_NAME
|
|
20
|
+
|
|
21
|
+
def verify_restore_file_already_exist(self, restore_file_path: str) -> bool:
|
|
22
|
+
return os.path.isfile(restore_file_path)
|
|
23
|
+
|
|
24
|
+
def get_working_directory(self, document: Document) -> Optional[str]:
|
|
25
|
+
return os.path.dirname(document.absolute_path)
|
{cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/sca/sca_code_scanner.py
RENAMED
|
@@ -7,8 +7,7 @@ from cycode.cli import consts
|
|
|
7
7
|
from cycode.cli.files_collector.sca.base_restore_dependencies import BaseRestoreDependencies
|
|
8
8
|
from cycode.cli.files_collector.sca.maven.restore_gradle_dependencies import RestoreGradleDependencies
|
|
9
9
|
from cycode.cli.files_collector.sca.maven.restore_maven_dependencies import RestoreMavenDependencies
|
|
10
|
-
from cycode.cli.files_collector.sca.
|
|
11
|
-
from cycode.cli.files_collector.sca.nuget.restore_nuget_dependencies import RestoreNugetDependencies
|
|
10
|
+
from cycode.cli.files_collector.sca.sbt.restore_sbt_dependencies import RestoreSbtDependencies
|
|
12
11
|
from cycode.cli.models import Document
|
|
13
12
|
from cycode.cli.utils.git_proxy import git_proxy
|
|
14
13
|
from cycode.cli.utils.path_utils import get_file_content, get_file_dir, get_path_from_context, join_paths
|
|
@@ -17,9 +16,7 @@ from cycode.cyclient import logger
|
|
|
17
16
|
if TYPE_CHECKING:
|
|
18
17
|
from git import Repo
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
BUILD_NUGET_DEP_TREE_TIMEOUT = 180
|
|
22
|
-
BUILD_NPM_DEP_TREE_TIMEOUT = 180
|
|
19
|
+
BUILD_DEP_TREE_TIMEOUT = 180
|
|
23
20
|
|
|
24
21
|
|
|
25
22
|
def perform_pre_commit_range_scan_actions(
|
|
@@ -132,10 +129,9 @@ def add_dependencies_tree_document(
|
|
|
132
129
|
|
|
133
130
|
def restore_handlers(context: click.Context, is_git_diff: bool) -> List[BaseRestoreDependencies]:
|
|
134
131
|
return [
|
|
135
|
-
RestoreGradleDependencies(context, is_git_diff,
|
|
136
|
-
RestoreMavenDependencies(context, is_git_diff,
|
|
137
|
-
|
|
138
|
-
RestoreNpmDependencies(context, is_git_diff, BUILD_NPM_DEP_TREE_TIMEOUT),
|
|
132
|
+
RestoreGradleDependencies(context, is_git_diff, BUILD_DEP_TREE_TIMEOUT),
|
|
133
|
+
RestoreMavenDependencies(context, is_git_diff, BUILD_DEP_TREE_TIMEOUT),
|
|
134
|
+
RestoreSbtDependencies(context, is_git_diff, BUILD_DEP_TREE_TIMEOUT),
|
|
139
135
|
]
|
|
140
136
|
|
|
141
137
|
|
|
@@ -7,12 +7,18 @@ from cycode.cyclient.models import Detection
|
|
|
7
7
|
|
|
8
8
|
class Document:
|
|
9
9
|
def __init__(
|
|
10
|
-
self,
|
|
10
|
+
self,
|
|
11
|
+
path: str,
|
|
12
|
+
content: str,
|
|
13
|
+
is_git_diff_format: bool = False,
|
|
14
|
+
unique_id: Optional[str] = None,
|
|
15
|
+
absolute_path: Optional[str] = None,
|
|
11
16
|
) -> None:
|
|
12
17
|
self.path = path
|
|
13
18
|
self.content = content
|
|
14
19
|
self.is_git_diff_format = is_git_diff_format
|
|
15
20
|
self.unique_id = unique_id
|
|
21
|
+
self.absolute_path = absolute_path
|
|
16
22
|
|
|
17
23
|
def __repr__(self) -> str:
|
|
18
24
|
return 'path:{0}, content:{1}'.format(self.path, self.content)
|
|
File without changes
|
|
File without changes
|
|
@@ -8,12 +8,16 @@ from cycode.cyclient import logger
|
|
|
8
8
|
_SUBPROCESS_DEFAULT_TIMEOUT_SEC = 60
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
def shell(
|
|
11
|
+
def shell(
|
|
12
|
+
command: Union[str, List[str]],
|
|
13
|
+
timeout: int = _SUBPROCESS_DEFAULT_TIMEOUT_SEC,
|
|
14
|
+
working_directory: Optional[str] = None,
|
|
15
|
+
) -> Optional[str]:
|
|
12
16
|
logger.debug('Executing shell command: %s', command)
|
|
13
17
|
|
|
14
18
|
try:
|
|
15
19
|
result = subprocess.run( # noqa: S603
|
|
16
|
-
command, timeout=timeout, check=True, capture_output=True
|
|
20
|
+
command, cwd=working_directory, timeout=timeout, check=True, capture_output=True
|
|
17
21
|
)
|
|
18
22
|
|
|
19
23
|
return result.stdout.decode('UTF-8').strip()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "cycode"
|
|
3
|
-
version = "1.11.1.
|
|
3
|
+
version = "1.11.1.dev9" # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
|
|
4
4
|
description = "Boost security in your dev lifecycle via SAST, SCA, Secrets & IaC scanning."
|
|
5
5
|
keywords=["secret-scan", "cycode", "devops", "token", "secret", "security", "cycode", "code"]
|
|
6
6
|
authors = ["Cycode <support@cycode.com>"]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '1.11.1.dev5' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/configure/configure_command.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/report/sbom/path/path_command.py
RENAMED
|
File without changes
|
{cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/report/sbom/repository_url/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/report/sbom/sbom_report_file.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/commit_history/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/pre_commit/pre_commit_command.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/scan_ci/ci_integrations.py
RENAMED
|
File without changes
|
{cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/commands/scan/scan_ci/scan_ci_command.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/exceptions/handle_report_sbom_errors.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/iac/tf_content_generator.py
RENAMED
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/models/in_memory_zip.py
RENAMED
|
File without changes
|
|
File without changes
|
{cycode-1.11.1.dev5 → cycode-1.11.1.dev9}/cycode/cli/files_collector/repository_documents.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
|
{cycode-1.11.1.dev5/cycode/cli/utils → cycode-1.11.1.dev9/cycode/cli/printers/tables}/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
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
|