cycode 3.26.1.dev3__py3-none-any.whl → 3.26.1.dev5__py3-none-any.whl

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/__init__.py CHANGED
@@ -5,4 +5,4 @@ import time as _time
5
5
  # end-to-end scan duration from the moment the user actually triggered it.
6
6
  _BOOT_WALL: float = _time.time()
7
7
 
8
- __version__ = '3.26.1.dev3' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
8
+ __version__ = '3.26.1.dev5' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
@@ -97,6 +97,7 @@ def scan_command(
97
97
  ScaScanTypeOption.PACKAGE_VULNERABILITIES,
98
98
  ScaScanTypeOption.LICENSE_COMPLIANCE,
99
99
  ScaScanTypeOption.UNMAINTAINED_PACKAGES,
100
+ ScaScanTypeOption.MALICIOUS_PACKAGES,
100
101
  ),
101
102
  monitor: Annotated[
102
103
  bool,
@@ -15,6 +15,7 @@ def _get_default_scan_parameters(ctx: typer.Context) -> dict:
15
15
  'package_vulnerabilities': ctx.obj.get('package-vulnerabilities'),
16
16
  'license_compliance': ctx.obj.get('license-compliance'),
17
17
  'maintainability': ctx.obj.get('unmaintained-packages', False),
18
+ 'malicious_packages': ctx.obj.get('malicious-packages', False),
18
19
  'command_type': ctx.info_name.replace('-', '_'), # save backward compatibility
19
20
  'aggregation_id': str(generate_unique_scan_id()),
20
21
  'cli_start_time': _BOOT_WALL,
cycode/cli/cli_types.py CHANGED
@@ -41,6 +41,7 @@ class ScaScanTypeOption(StrEnum):
41
41
  PACKAGE_VULNERABILITIES = 'package-vulnerabilities'
42
42
  LICENSE_COMPLIANCE = 'license-compliance'
43
43
  UNMAINTAINED_PACKAGES = 'unmaintained-packages'
44
+ MALICIOUS_PACKAGES = 'malicious-packages'
44
45
 
45
46
 
46
47
  class SbomFormatOption(StrEnum):
cycode/cli/consts.py CHANGED
@@ -353,6 +353,7 @@ SCAN_ERROR_STATUS_CODE = 2
353
353
  LICENSE_COMPLIANCE_POLICY_ID = '8f681450-49e1-4f7e-85b7-0c8fe84b3a35'
354
354
  PACKAGE_VULNERABILITY_POLICY_ID = '9369d10a-9ac0-48d3-9921-5de7fe9a37a7'
355
355
  UNMAINTAINED_PACKAGE_POLICY_ID = '7b45ee1f-ee08-4353-a00a-2586db27b0f1'
356
+ MALICIOUS_PACKAGE_POLICY_ID = '1fe6d83a-19de-48a2-a5ba-a80fe648489b'
356
357
 
357
358
  # Shortcut dependency paths by remove all middle dependencies
358
359
  # between direct dependency and influence/vulnerable dependency.
@@ -4,6 +4,7 @@ from typing import TYPE_CHECKING
4
4
  from cycode.cli.cli_types import SeverityOption
5
5
  from cycode.cli.consts import (
6
6
  LICENSE_COMPLIANCE_POLICY_ID,
7
+ MALICIOUS_PACKAGE_POLICY_ID,
7
8
  PACKAGE_VULNERABILITY_POLICY_ID,
8
9
  UNMAINTAINED_PACKAGE_POLICY_ID,
9
10
  )
@@ -28,6 +29,7 @@ CODE_PROJECT_COLUMN = column_builder.build(name='Code Project', highlight=False)
28
29
  ECOSYSTEM_COLUMN = column_builder.build(name='Ecosystem', highlight=False)
29
30
  PACKAGE_COLUMN = column_builder.build(name='Package', highlight=False)
30
31
  CVE_COLUMNS = column_builder.build(name='CVE', highlight=False)
32
+ ADVISORY_COLUMN = column_builder.build(name='Advisory', highlight=False)
31
33
  MAINTAINED_SCORE_COLUMN = column_builder.build(name='Maintained Score', highlight=False)
32
34
  DEPENDENCY_PATHS_COLUMN = column_builder.build(name='Dependency Paths')
33
35
  UPGRADE_COLUMN = column_builder.build(name='Upgrade')
@@ -59,6 +61,8 @@ class ScaTablePrinter(TablePrinterBase):
59
61
  return 'License Compliance'
60
62
  if policy_id == UNMAINTAINED_PACKAGE_POLICY_ID:
61
63
  return 'Unmaintained Packages'
64
+ if policy_id == MALICIOUS_PACKAGE_POLICY_ID:
65
+ return 'Malicious Packages'
62
66
 
63
67
  return 'Unknown'
64
68
 
@@ -72,6 +76,8 @@ class ScaTablePrinter(TablePrinterBase):
72
76
  table.add_column(LICENSE_COLUMN)
73
77
  elif policy_id == UNMAINTAINED_PACKAGE_POLICY_ID:
74
78
  table.add_column(MAINTAINED_SCORE_COLUMN)
79
+ elif policy_id == MALICIOUS_PACKAGE_POLICY_ID:
80
+ table.add_column(ADVISORY_COLUMN)
75
81
 
76
82
  if is_git_diff_based_scan(self.command_scan_type):
77
83
  table.add_column(REPOSITORY_COLUMN)
@@ -128,6 +134,7 @@ class ScaTablePrinter(TablePrinterBase):
128
134
  table.add_cell(UPGRADE_COLUMN, upgrade)
129
135
 
130
136
  table.add_cell(CVE_COLUMNS, detection_details.get('vulnerability_id'))
137
+ table.add_cell(ADVISORY_COLUMN, detection_details.get('threat_id') or 'N/A')
131
138
  table.add_cell(LICENSE_COLUMN, detection_details.get('license'))
132
139
 
133
140
  if detection.detection_type_id == UNMAINTAINED_PACKAGE_POLICY_ID:
@@ -3,6 +3,7 @@ from typing import TYPE_CHECKING
3
3
 
4
4
  from cycode.cli.consts import (
5
5
  LICENSE_COMPLIANCE_POLICY_ID,
6
+ MALICIOUS_PACKAGE_POLICY_ID,
6
7
  PACKAGE_VULNERABILITY_POLICY_ID,
7
8
  SCA_SCAN_TYPE,
8
9
  UNMAINTAINED_PACKAGE_POLICY_ID,
@@ -40,10 +41,30 @@ def _unmaintained_package_details(detection: 'Detection') -> list[tuple[str, str
40
41
  ]
41
42
 
42
43
 
44
+ def _malicious_package_details(detection: 'Detection') -> list[tuple[str, str]]:
45
+ detection_details = detection.detection_details
46
+
47
+ # A MAL- id matches none of the CVE/GHSA/CWE URL shapes, so the advisory URL comes from the detection.
48
+ threat_id = detection_details.get('threat_id')
49
+ advisory_url = detection_details.get('advisory_url')
50
+ if not threat_id:
51
+ advisory = _NOT_AVAILABLE
52
+ elif advisory_url:
53
+ advisory = f'[link={advisory_url}]{threat_id}[/]'
54
+ else:
55
+ advisory = threat_id
56
+
57
+ return [
58
+ ('Advisory', advisory),
59
+ ('Remediation', detection_details.get('remediation_guidelines') or _NOT_AVAILABLE),
60
+ ]
61
+
62
+
43
63
  _DETAILS_BY_POLICY: dict[str, Callable[['Detection'], list[tuple[str, str]]]] = {
44
64
  PACKAGE_VULNERABILITY_POLICY_ID: _package_vulnerability_details,
45
65
  LICENSE_COMPLIANCE_POLICY_ID: _license_compliance_details,
46
66
  UNMAINTAINED_PACKAGE_POLICY_ID: _unmaintained_package_details,
67
+ MALICIOUS_PACKAGE_POLICY_ID: _malicious_package_details,
47
68
  }
48
69
 
49
70
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cycode
3
- Version: 3.26.1.dev3
3
+ Version: 3.26.1.dev5
4
4
  Summary: Boost security in your dev lifecycle via SAST, SCA, Secrets & IaC scanning.
5
5
  License-Expression: MIT
6
6
  License-File: LICENCE
@@ -23,7 +23,7 @@ Requires-Dist: anyio (>=4.14.2,<5.0.0)
23
23
  Requires-Dist: arrow (>=1.0.0,<1.5.0)
24
24
  Requires-Dist: click (>=8.1.0,<8.2.0)
25
25
  Requires-Dist: colorama (>=0.4.3,<0.5.0)
26
- Requires-Dist: gitpython (>=3.1.62,<3.2.0)
26
+ Requires-Dist: gitpython (>=3.2.1,<3.3.0)
27
27
  Requires-Dist: marshmallow (>=4.1.2,<5.0.0)
28
28
  Requires-Dist: mcp (>=1.30.0,<2.0.0)
29
29
  Requires-Dist: patch-ng (==1.19.1)
@@ -829,7 +829,7 @@ The Cycode CLI application offers several types of scans so that you can choose
829
829
  | `--show-secret BOOLEAN` | Show secrets in plain text. See [Show/Hide Secrets](#showhide-secrets) section for more details. |
830
830
  | `--soft-fail BOOLEAN` | Run scan without failing, always return a non-error status code. See [Soft Fail](#soft-fail) section for more details. |
831
831
  | `--severity-threshold [INFO\|LOW\|MEDIUM\|HIGH\|CRITICAL]` | Show only violations at the specified level or higher. |
832
- | `--sca-scan` | Specify the SCA scan you wish to execute (`package-vulnerabilities`/`license-compliance`/`unmaintained-packages`). The default is all. |
832
+ | `--sca-scan` | Specify the SCA scan you wish to execute (`package-vulnerabilities`/`license-compliance`/`unmaintained-packages`/`malicious-packages`). The default is all. |
833
833
  | `--monitor` | When specified, the scan results will be recorded in Cycode. |
834
834
  | `--cycode-report` | Display a link to the scan report in the Cycode platform in the console output. |
835
835
  | `--no-restore` | When specified, Cycode will not run the restore command. This will scan direct dependencies ONLY! |
@@ -921,6 +921,22 @@ In the previous example, if you wanted to only run an SCA scan on unmaintained p
921
921
 
922
922
  `cycode scan -t sca --sca-scan unmaintained-packages repository ~/home/git/codebase`
923
923
 
924
+ #### Malicious Packages Option
925
+
926
+ > [!NOTE]
927
+ > This option is only available to SCA scans.
928
+
929
+ To scan only for malicious packages (dependencies that a security advisory has identified as malware rather than merely vulnerable), add the argument `--sca-scan malicious-packages` following the `-t sca` or `--scan-type sca` option.
930
+
931
+ Malicious package violations are always reported as `Critical`, and carry no CVSS score and no fix version: the only remediation is removing the dependency.
932
+
933
+ > [!NOTE]
934
+ > Whether malicious packages are reported at all is controlled by your organization's policy. This option narrows what a scan reports; it cannot enable a policy that is turned off for your tenant.
935
+
936
+ In the previous example, if you wanted to only run an SCA scan on malicious packages, you could execute the following:
937
+
938
+ `cycode scan -t sca --sca-scan malicious-packages repository ~/home/git/codebase`
939
+
924
940
  #### Lock Restore Option
925
941
 
926
942
  > [!NOTE]
@@ -1,4 +1,4 @@
1
- cycode/__init__.py,sha256=w0X7J8W7Bo3sRZmhsJxom68aKI6dwGHAaMNkm8bfqH8,396
1
+ cycode/__init__.py,sha256=41M2oydcxIQJhmjCmwskClQxPPLgQA1_ZX3j-oyCkyY,396
2
2
  cycode/__main__.py,sha256=Z3bD5yrA7yPvAChcADQrqCaZd0ChGI1gdiwALwbWJ6U,104
3
3
  cycode/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  cycode/cli/app.py,sha256=sI6wBHmfo7RchO9rnOXaQyUHRG9fm4r9aIduV4ZOD5c,10167
@@ -88,18 +88,18 @@ cycode/cli/apps/scan/repository/repository_command.py,sha256=KTON0Piq04P4s55AA2_
88
88
  cycode/cli/apps/scan/scan_ci/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
89
89
  cycode/cli/apps/scan/scan_ci/ci_integrations.py,sha256=3ZUv1uLsHC13KTNQ4erQKKDXAkmaSm5jow2Utwr4mCw,1634
90
90
  cycode/cli/apps/scan/scan_ci/scan_ci_command.py,sha256=37I6YTs5UWYtbnDe1EeYZnhV1twFTDUrniZ4Sf2_6Kk,562
91
- cycode/cli/apps/scan/scan_command.py,sha256=UDlibvQ3R9zQVN-PV-5DuNV5bmgU4cFq4rdeWQFzYHQ,7945
92
- cycode/cli/apps/scan/scan_parameters.py,sha256=1Z1L80eL3X8wJszXddAkawmH1WlymrBPNfWd09C1XU4,1449
91
+ cycode/cli/apps/scan/scan_command.py,sha256=aiD1b-F6-RerAjg6RJiXI7GdyYE6HTbiq-HcN64rsQo,7991
92
+ cycode/cli/apps/scan/scan_parameters.py,sha256=NhIVlp-IlVzG5ss1J4hGI3sznE33DaR-Fm5JJtwxkLU,1521
93
93
  cycode/cli/apps/scan/scan_result.py,sha256=5PGmw-6MsGsfqcClXq34DkNqMcE05QLtIxP-DD80nkE,9113
94
94
  cycode/cli/apps/status/__init__.py,sha256=uxfkEBafO7Da0mPc1fZhwoO0RTtyXp2a5T3LJTZxubU,371
95
95
  cycode/cli/apps/status/get_cli_status.py,sha256=1UAVyKPpYk2S8nQYshKD1x5xgWR-hCTchLChxNU0JVA,2577
96
96
  cycode/cli/apps/status/models.py,sha256=2SBpJlh_MNCPxv8aXMV5D4GfK6-G-XB0GlMFZ3Nep_o,1907
97
97
  cycode/cli/apps/status/status_command.py,sha256=B8YZ4hibWkjkAkikailll2lkJmCRYh9APdvZSR4L33c,1069
98
98
  cycode/cli/apps/status/version_command.py,sha256=c6Iko_rmZo9T_kQSd3HUloBi40Qv7cjgKJNVxpMiMfE,315
99
- cycode/cli/cli_types.py,sha256=Xqf2eSx3yUvFoQG29ObUZ3QLVBhtZ4mkqxf_cJXpntU,3406
99
+ cycode/cli/cli_types.py,sha256=CUrFCJDz_vORdpue8bl29DiUqJkf3iiNO_gWBtUhypk,3452
100
100
  cycode/cli/config.py,sha256=Op-lX_neanJtvPvoOEx4ByBdveh5ygElIga1FdSHhOI,299
101
101
  cycode/cli/console.py,sha256=fsKqkOQCkvVn34Vf0XYBjXwKbK51J_Ic7mLBFUtsjzI,1901
102
- cycode/cli/consts.py,sha256=gYldShCpOT1m6_wi2LVgdPbl9sMxOs7o7KMYFj_QqHo,11221
102
+ cycode/cli/consts.py,sha256=3vTOZeeJCwVkmUCM-a8DnU-DoD5oNrdLGHS6nbOz31c,11290
103
103
  cycode/cli/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
104
104
  cycode/cli/exceptions/custom_exceptions.py,sha256=Mvjfkww2mmMBBCD4OWAkSfl_9iOvi4bLTLGLBL7OdOk,5423
105
105
  cycode/cli/exceptions/handle_ai_remediation_errors.py,sha256=mA70upSYXK3rL_fmanzKYeUzLENhpXdkW8k3aIHrKzU,785
@@ -161,7 +161,7 @@ cycode/cli/printers/json_printer.py,sha256=nOwVH10h-W5z9Xz6ZPSEj9DMDby9bzpZm-q1T
161
161
  cycode/cli/printers/printer_base.py,sha256=fx-fLXNUJGJu7dlmH4t-HH4gzo5yYJCxzUD7ie2xr08,3723
162
162
  cycode/cli/printers/rich_printer.py,sha256=qOcTkr4wUnaHx-KFKWAtx8gRdoTS8EpupWivOtFqfjA,7367
163
163
  cycode/cli/printers/tables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
164
- cycode/cli/printers/tables/sca_table_printer.py,sha256=9FC3lC9BPuKXn8aTX1b3yUjEm5EudrGFlkDfwnVjM5s,6992
164
+ cycode/cli/printers/tables/sca_table_printer.py,sha256=6UQLkvVN1fAKptVWA2OHiPGH2a6u4ICJKJXEXEPr-PQ,7377
165
165
  cycode/cli/printers/tables/table.py,sha256=eu9xuZ9U525xgXqoEOEdGOYrrQZKPCkfjEdeuYU3ZF8,2557
166
166
  cycode/cli/printers/tables/table_models.py,sha256=pEPbsMxL3JYQ77anPy1Fxtf1U0vu5NVtKiPTFBsoLUM,725
167
167
  cycode/cli/printers/tables/table_printer.py,sha256=8lYrjX_jaQrckOe7SSdIl6_uvyGbCsWaoxym8TTfhRQ,4693
@@ -175,7 +175,7 @@ cycode/cli/printers/utils/detection_ordering/common_ordering.py,sha256=WxdDGL9Hj
175
175
  cycode/cli/printers/utils/detection_ordering/sca_ordering.py,sha256=nEy9PIrApLBi1hrhKbIZ5x8XVK0LW4jsKxzax3leM7o,2315
176
176
  cycode/cli/printers/utils/rich_helpers.py,sha256=mUd9hIgZdRp0ZKfL26NHCrGdITKb2dvVtUSrYpZicck,1079
177
177
  cycode/cli/printers/utils/sca_ossf.py,sha256=KZRrLZAhCRJFo8aO4ldMcuCLUBUET1MJMM3hQqnPbc8,701
178
- cycode/cli/printers/utils/sca_policy_details.py,sha256=hw-eU9Qyw5BiFtZOo4weEfs40MBUx3rnwogwLmb0Aeg,2338
178
+ cycode/cli/printers/utils/sca_policy_details.py,sha256=poMGNcRfObFJyvTtK86_rmTvBlOeRJsPYMjLyFDBydQ,3103
179
179
  cycode/cli/user_settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
180
180
  cycode/cli/user_settings/base_file_manager.py,sha256=SLA5xRMTqSY-PtbeKCtVc9rP_ljxUYe3z3ZU-XE2x0w,844
181
181
  cycode/cli/user_settings/config_file_manager.py,sha256=VszlQsWwNCX93uN4h9d7wFA9Ww1sWudMTr9IgtRuPmE,5600
@@ -224,8 +224,8 @@ cycode/cyclient/report_client.py,sha256=PaKEo6Q0GFVdpNC18vvR4uBoUX1MnllVmKkS72eA
224
224
  cycode/cyclient/scan_client.py,sha256=AZ-3G9eC8Y_-jjivllP7ESPpdLds0Dkl4-KIxe5jNyE,16944
225
225
  cycode/cyclient/scan_config_base.py,sha256=mXsPZGYCtp85rv5GIige40yQZXuRcEKUW-VQJ0vgFzk,1201
226
226
  cycode/logger.py,sha256=OHmfkf4dnyZgfixGqkWf3js3uysrOXU_4cS8TChtAzc,2079
227
- cycode-3.26.1.dev3.dist-info/METADATA,sha256=BQ0YMHvKBKjMfQOFPboTfyD4gPL2FJd9BsFuFNNOrM4,96119
228
- cycode-3.26.1.dev3.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
229
- cycode-3.26.1.dev3.dist-info/entry_points.txt,sha256=iDcVJM8ByLElVgvBgtYxDjw1kT7O8Mo0LcWZIT5L3Ig,45
230
- cycode-3.26.1.dev3.dist-info/licenses/LICENCE,sha256=2Wx4N6mD_4xB7-E3hPkZ3MPhpJy__k_I8MaCSO-PDRo,1068
231
- cycode-3.26.1.dev3.dist-info/RECORD,,
227
+ cycode-3.26.1.dev5.dist-info/METADATA,sha256=j6T4taDmDbSnaWE0MvFRzRlK6-JAohRO1jxLYF7-ty4,97032
228
+ cycode-3.26.1.dev5.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
229
+ cycode-3.26.1.dev5.dist-info/entry_points.txt,sha256=iDcVJM8ByLElVgvBgtYxDjw1kT7O8Mo0LcWZIT5L3Ig,45
230
+ cycode-3.26.1.dev5.dist-info/licenses/LICENCE,sha256=2Wx4N6mD_4xB7-E3hPkZ3MPhpJy__k_I8MaCSO-PDRo,1068
231
+ cycode-3.26.1.dev5.dist-info/RECORD,,