cycode 3.15.3.dev5__py3-none-any.whl → 3.15.3.dev7__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
@@ -1 +1 @@
1
- __version__ = '3.15.3.dev5' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
1
+ __version__ = '3.15.3.dev7' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
@@ -1,3 +1,4 @@
1
+ import json
1
2
  from os import path
2
3
  from pathlib import Path
3
4
  from typing import Optional
@@ -20,6 +21,16 @@ MAVEN_CYCLONE_DEP_TREE_FILE_NAME = 'bom.json'
20
21
  MAVEN_DEP_TREE_FILE_NAME = 'bcde.mvndeps'
21
22
 
22
23
 
24
+ def _has_dependency_graph(bom_content: Optional[str]) -> bool:
25
+ try:
26
+ if not bom_content:
27
+ return False
28
+ bom = json.loads(bom_content)
29
+ return any(dep.get('dependsOn') for dep in bom.get('dependencies', []))
30
+ except Exception:
31
+ return False
32
+
33
+
23
34
  class RestoreMavenDependencies(BaseRestoreDependencies):
24
35
  def __init__(self, ctx: typer.Context, is_git_diff: bool, command_timeout: int) -> None:
25
36
  super().__init__(ctx, is_git_diff, command_timeout)
@@ -46,8 +57,16 @@ class RestoreMavenDependencies(BaseRestoreDependencies):
46
57
  if document.content is None:
47
58
  return self.restore_from_secondary_command(document, manifest_file_path)
48
59
 
49
- # super() reads the content and cleans up any generated file; no re-read needed
50
- return super().try_restore_dependencies(document)
60
+ restore_dependencies_document = super().try_restore_dependencies(document)
61
+ if restore_dependencies_document is None:
62
+ return None
63
+
64
+ if not _has_dependency_graph(restore_dependencies_document.content):
65
+ fallback = self.restore_from_secondary_command(document, manifest_file_path)
66
+ if fallback is not None and fallback.content is not None:
67
+ return fallback
68
+
69
+ return restore_dependencies_document
51
70
 
52
71
  def restore_from_secondary_command(self, document: Document, manifest_file_path: str) -> Optional[Document]:
53
72
  restore_content = execute_commands(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cycode
3
- Version: 3.15.3.dev5
3
+ Version: 3.15.3.dev7
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=FE403Ok8PCnIL3ubQcAh4lsDj3Lmjhh7VlDQTgISJmE,115
1
+ cycode/__init__.py,sha256=XvbLa7dFUERdk8IUnLa6Bb3K2FbGOql-Ipx1O_kb6Ng,115
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=7ReEcVkRX9IaQ2I7jAj7Sl9smbtvxiuK8-9bitMEQik,7491
@@ -115,7 +115,7 @@ cycode/cli/files_collector/sca/go/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
115
115
  cycode/cli/files_collector/sca/go/restore_go_dependencies.py,sha256=LXUjslfdHO3umz36WtQyRpKa_fVaRgEjewVkZ0QvnYU,1899
116
116
  cycode/cli/files_collector/sca/maven/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
117
117
  cycode/cli/files_collector/sca/maven/restore_gradle_dependencies.py,sha256=hwsdJby0_7i3s6YmCU-tB6B3TfsfbyQyeTVwEy6c6SA,2699
118
- cycode/cli/files_collector/sca/maven/restore_maven_dependencies.py,sha256=n1DI0LLFWyC9YwqJXtQmoeanF8ULi-OAVBako1jd2TE,3377
118
+ cycode/cli/files_collector/sca/maven/restore_maven_dependencies.py,sha256=zObNN8n6yUriNVB3ZdvAkoKXXrMvzU9Lpd5lNhVo_so,4003
119
119
  cycode/cli/files_collector/sca/npm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
120
120
  cycode/cli/files_collector/sca/npm/restore_deno_dependencies.py,sha256=XL0VXEPL0jf6ruZZkCpv99lkU8-MNc09CU1fgGgTbHs,1768
121
121
  cycode/cli/files_collector/sca/npm/restore_npm_dependencies.py,sha256=oUPJa1qwzCg3h1eZeVrU95Fluubo7p5gNlGmjJQem-4,2477
@@ -204,8 +204,8 @@ cycode/cyclient/report_client.py,sha256=Scq30NeJPzgXv0hPLO1U05AdE9i_2iu6cIrSKpEJ
204
204
  cycode/cyclient/scan_client.py,sha256=6TK5FQkfrvV7PHqRnUzEn1PBNd2oPYVamvIixcUfe3c,16755
205
205
  cycode/cyclient/scan_config_base.py,sha256=mXsPZGYCtp85rv5GIige40yQZXuRcEKUW-VQJ0vgFzk,1201
206
206
  cycode/logger.py,sha256=EfZGRK6VC5rE_LAjIcRrHFiQCueylCDXoG6bvGkrIME,2111
207
- cycode-3.15.3.dev5.dist-info/METADATA,sha256=6NBiIxt_CTk8S4Qup_r8XyevQh_AFYOqGe-FmKWYHjs,87415
208
- cycode-3.15.3.dev5.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
209
- cycode-3.15.3.dev5.dist-info/entry_points.txt,sha256=iDcVJM8ByLElVgvBgtYxDjw1kT7O8Mo0LcWZIT5L3Ig,45
210
- cycode-3.15.3.dev5.dist-info/licenses/LICENCE,sha256=2Wx4N6mD_4xB7-E3hPkZ3MPhpJy__k_I8MaCSO-PDRo,1068
211
- cycode-3.15.3.dev5.dist-info/RECORD,,
207
+ cycode-3.15.3.dev7.dist-info/METADATA,sha256=d0aIuuYsyssqRrtQgXFQLzOS7y2gZe2zmKtnZabff_M,87415
208
+ cycode-3.15.3.dev7.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
209
+ cycode-3.15.3.dev7.dist-info/entry_points.txt,sha256=iDcVJM8ByLElVgvBgtYxDjw1kT7O8Mo0LcWZIT5L3Ig,45
210
+ cycode-3.15.3.dev7.dist-info/licenses/LICENCE,sha256=2Wx4N6mD_4xB7-E3hPkZ3MPhpJy__k_I8MaCSO-PDRo,1068
211
+ cycode-3.15.3.dev7.dist-info/RECORD,,