cycode 3.27.1.dev10__py3-none-any.whl → 3.27.1.dev11__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.27.1.dev10' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
8
+ __version__ = '3.27.1.dev11' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
@@ -121,26 +121,17 @@ def _should_use_sync_flow(command_scan_type: str, scan_type: str, sync_option: b
121
121
  Passing `--sync` option does not mean that sync flow will be used in all cases.
122
122
 
123
123
  The logic:
124
- - for IAC scan, sync flow is always used
125
- - for SAST scan, sync flow is not supported
126
- - for SCA and Secrets scan, sync flow is supported only for path/repository scan
124
+ - for IaC and SAST scans, the async flow is always used
125
+ - for SCA and Secrets scans, sync flow is used only with `--sync` on path/repository scans
127
126
 
128
127
  """
129
- if not sync_option and scan_type != consts.IAC_SCAN_TYPE:
128
+ if scan_type in {consts.IAC_SCAN_TYPE, consts.SAST_SCAN_TYPE}:
130
129
  return False
131
130
 
132
- if command_scan_type not in {'path', 'repository', 'ai_guardrails'}:
131
+ if not sync_option:
133
132
  return False
134
133
 
135
- if scan_type == consts.IAC_SCAN_TYPE:
136
- # sync in the only available flow for IAC scan; we do not use detector directly anymore
137
- return True
138
-
139
- if scan_type is consts.SAST_SCAN_TYPE: # noqa: SIM103
140
- # SAST does not support sync flow
141
- return False
142
-
143
- return True
134
+ return command_scan_type in {'path', 'repository', 'ai_guardrails'}
144
135
 
145
136
 
146
137
  def _get_scan_documents_thread_func(
@@ -23,6 +23,8 @@ from cycode.cyclient.logger import logger
23
23
  if TYPE_CHECKING:
24
24
  from cycode.cyclient.scan_config_base import ScanConfigBase
25
25
 
26
+ _DETECTION_RULES_IDS_PER_REQUEST = 50
27
+
26
28
 
27
29
  class ScanClient:
28
30
  def __init__(
@@ -317,13 +319,18 @@ class ScanClient:
317
319
  return models.DetectionRuleSchema().load(response.json(), many=True)
318
320
 
319
321
  def get_detection_rules(self, detection_rules_ids: set[str] | list[str]) -> list[models.DetectionRule]:
320
- response = self.scan_cycode_client.get(
321
- url_path=self.get_detection_rules_path(),
322
- params={'ids': detection_rules_ids},
323
- hide_response_content_log=self._hide_response_log,
324
- )
322
+ # The ids go in the query string; too many of them exceed the URL limit (HTTP 414).
323
+ ids = list(detection_rules_ids)
324
+ detection_rules = []
325
+ for start in range(0, len(ids), _DETECTION_RULES_IDS_PER_REQUEST):
326
+ response = self.scan_cycode_client.get(
327
+ url_path=self.get_detection_rules_path(),
328
+ params={'ids': ids[start : start + _DETECTION_RULES_IDS_PER_REQUEST]},
329
+ hide_response_content_log=self._hide_response_log,
330
+ )
331
+ detection_rules.extend(self.parse_detection_rules_response(response))
325
332
 
326
- return self.parse_detection_rules_response(response)
333
+ return detection_rules
327
334
 
328
335
  def get_scan_detections_path(self) -> str:
329
336
  return f'{self.scan_config.get_detections_prefix()}/{self._DETECTIONS_SERVICE_CLI_CONTROLLER_PATH}'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cycode
3
- Version: 3.27.1.dev10
3
+ Version: 3.27.1.dev11
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
@@ -1,4 +1,4 @@
1
- cycode/__init__.py,sha256=1tn6Bbjmh2-Kee2477aXJJEpFPk1q0dPWmWNykULOYg,397
1
+ cycode/__init__.py,sha256=662oEouYyywiE4bzqGxYuM04FRJMS1yiJ_No3tvbCMY,397
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
@@ -69,7 +69,7 @@ cycode/cli/apps/report_import/sbom/sbom_command.py,sha256=9P56i7RobFPrkd5MmsVNe8
69
69
  cycode/cli/apps/sca_options.py,sha256=wqe7dZUML_iiBUko74k7ngeGcV8sdCxIOB-s1Zy5l_Q,1650
70
70
  cycode/cli/apps/scan/__init__.py,sha256=qGKJ5Hn9X1mygsHsCX7PP7ksuxA2jwIHMZIwsDsrGvA,2537
71
71
  cycode/cli/apps/scan/aggregation_report.py,sha256=5fSsLM8UajstayR5f-teEcjK05nSr7G7OeegP8tqwwQ,1528
72
- cycode/cli/apps/scan/code_scanner.py,sha256=Ucklo5vQAKNsdtlNcwd1fkMzXlphRdkjOYqYvph0cgE,19740
72
+ cycode/cli/apps/scan/code_scanner.py,sha256=8Mm7OHxo6mfl4Z3ujtIS64WI_MfUuKM0XxrG1p7GTeE,19447
73
73
  cycode/cli/apps/scan/commit_history/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
74
  cycode/cli/apps/scan/commit_history/commit_history_command.py,sha256=zTVmN8yeLXGAiCbyDL-EyEzSPNLzcRpP2q6Qq7p4uZA,1011
75
75
  cycode/cli/apps/scan/commit_range_scanner.py,sha256=eoXfUNQKR-qjBYRV_M7FE6JGAztWe3yj432aBl-lM7s,17993
@@ -221,11 +221,11 @@ cycode/cyclient/import_sbom_client.py,sha256=AvEa6APERHGT-1v3LtENuekrse7tGgLr18D
221
221
  cycode/cyclient/logger.py,sha256=oTkay7QzoOIVQ71cGOy4ukkijYGA3IKJlHkL24Px5ds,70
222
222
  cycode/cyclient/models.py,sha256=4JjBL7kxkoztXvbFy9fy67JZ0U8z6bMDabp4HN9uQD0,17942
223
223
  cycode/cyclient/report_client.py,sha256=PaKEo6Q0GFVdpNC18vvR4uBoUX1MnllVmKkS72eAPmk,4368
224
- cycode/cyclient/scan_client.py,sha256=AZ-3G9eC8Y_-jjivllP7ESPpdLds0Dkl4-KIxe5jNyE,16944
224
+ cycode/cyclient/scan_client.py,sha256=ft80sGTsW-BW4bECuGdfLv0CrSdIkp_RLlGfwHVf_Fs,17325
225
225
  cycode/cyclient/scan_config_base.py,sha256=mXsPZGYCtp85rv5GIige40yQZXuRcEKUW-VQJ0vgFzk,1201
226
226
  cycode/logger.py,sha256=OHmfkf4dnyZgfixGqkWf3js3uysrOXU_4cS8TChtAzc,2079
227
- cycode-3.27.1.dev10.dist-info/METADATA,sha256=z2h7vMQst-EuJ1r4blCQqkZdGU9FcckeI_X-8kf1XEw,97033
228
- cycode-3.27.1.dev10.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
229
- cycode-3.27.1.dev10.dist-info/entry_points.txt,sha256=iDcVJM8ByLElVgvBgtYxDjw1kT7O8Mo0LcWZIT5L3Ig,45
230
- cycode-3.27.1.dev10.dist-info/licenses/LICENCE,sha256=2Wx4N6mD_4xB7-E3hPkZ3MPhpJy__k_I8MaCSO-PDRo,1068
231
- cycode-3.27.1.dev10.dist-info/RECORD,,
227
+ cycode-3.27.1.dev11.dist-info/METADATA,sha256=RVOTrkHAfCBqOQpDvT3CgsnPmhN8_yuRa4GsFjQOYl4,97033
228
+ cycode-3.27.1.dev11.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
229
+ cycode-3.27.1.dev11.dist-info/entry_points.txt,sha256=iDcVJM8ByLElVgvBgtYxDjw1kT7O8Mo0LcWZIT5L3Ig,45
230
+ cycode-3.27.1.dev11.dist-info/licenses/LICENCE,sha256=2Wx4N6mD_4xB7-E3hPkZ3MPhpJy__k_I8MaCSO-PDRo,1068
231
+ cycode-3.27.1.dev11.dist-info/RECORD,,