cycode 1.9.3.dev2__py3-none-any.whl → 1.9.4.dev1__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__ = '1.9.3.dev2' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
1
+ __version__ = '1.9.4.dev1' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
cycode/cli/consts.py CHANGED
@@ -116,6 +116,7 @@ TIMEOUT_ENV_VAR_NAME = 'TIMEOUT'
116
116
  CYCODE_CLI_REQUEST_TIMEOUT_ENV_VAR_NAME = 'CYCODE_CLI_REQUEST_TIMEOUT'
117
117
  LOGGING_LEVEL_ENV_VAR_NAME = 'LOGGING_LEVEL'
118
118
  VERBOSE_ENV_VAR_NAME = 'CYCODE_CLI_VERBOSE'
119
+ DEBUG_ENV_VAR_NAME = 'CYCODE_CLI_DEBUG'
119
120
 
120
121
  CYCODE_CONFIGURATION_DIRECTORY: str = '.cycode'
121
122
 
@@ -1,13 +1,19 @@
1
1
  from io import BytesIO
2
2
  from sys import getsizeof
3
- from typing import Optional
3
+ from typing import TYPE_CHECKING, Optional
4
4
  from zipfile import ZIP_DEFLATED, ZipFile
5
5
 
6
+ from cycode.cli.user_settings.configuration_manager import ConfigurationManager
6
7
  from cycode.cli.utils.path_utils import concat_unique_id
7
8
 
9
+ if TYPE_CHECKING:
10
+ from pathlib import Path
11
+
8
12
 
9
13
  class InMemoryZip(object):
10
14
  def __init__(self) -> None:
15
+ self.configuration_manager = ConfigurationManager()
16
+
11
17
  # Create the in-memory file-like object
12
18
  self.in_memory_zip = BytesIO()
13
19
  self.zip = ZipFile(self.in_memory_zip, 'a', ZIP_DEFLATED, False)
@@ -27,6 +33,10 @@ class InMemoryZip(object):
27
33
  self.in_memory_zip.seek(0)
28
34
  return self.in_memory_zip.read()
29
35
 
36
+ def write_on_disk(self, path: 'Path') -> None:
37
+ with open(path, 'wb') as f:
38
+ f.write(self.read())
39
+
30
40
  @property
31
41
  def size(self) -> int:
32
42
  return getsizeof(self.in_memory_zip)
@@ -1,4 +1,5 @@
1
1
  import time
2
+ from pathlib import Path
2
3
  from typing import List, Optional
3
4
 
4
5
  from cycode.cli import consts
@@ -37,4 +38,9 @@ def zip_documents(scan_type: str, documents: List[Document], zip_file: Optional[
37
38
  zip_creation_time = int(end_zip_creation_time - start_zip_creation_time)
38
39
  logger.debug('finished to create zip file, %s', {'zip_creation_time': zip_creation_time})
39
40
 
41
+ if zip_file.configuration_manager.get_debug_flag():
42
+ zip_file_path = Path.joinpath(Path.cwd(), f'{scan_type}_scan_{end_zip_creation_time}.zip')
43
+ logger.debug('writing zip file to disk, %s', {'zip_file_path': zip_file_path})
44
+ zip_file.write_on_disk(zip_file_path)
45
+
40
46
  return zip_file
@@ -46,6 +46,13 @@ class ConfigurationManager:
46
46
 
47
47
  return consts.DEFAULT_CYCODE_APP_URL
48
48
 
49
+ def get_debug_flag_from_environment_variables(self) -> bool:
50
+ value = self._get_value_from_environment_variables(consts.DEBUG_ENV_VAR_NAME, '')
51
+ return value.lower() in {'true', '1'}
52
+
53
+ def get_debug_flag(self) -> bool:
54
+ return self.get_debug_flag_from_environment_variables()
55
+
49
56
  def get_verbose_flag(self) -> bool:
50
57
  verbose_flag_env_var = self.get_verbose_flag_from_environment_variables()
51
58
  verbose_flag_local_config = self.local_config_file_manager.get_verbose_flag()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cycode
3
- Version: 1.9.3.dev2
3
+ Version: 1.9.4.dev1
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
@@ -1,4 +1,4 @@
1
- cycode/__init__.py,sha256=cy8XpUgIqdCw5GuAMDRldvNcJkO0mcalgaqp_MEIf6w,114
1
+ cycode/__init__.py,sha256=hl_i-pYaWM0tRpuaJbQyv28V7ffwMR00Pb6c2pne5SM,114
2
2
  cycode/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  cycode/cli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  cycode/cli/commands/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -39,7 +39,7 @@ cycode/cli/commands/version/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
39
39
  cycode/cli/commands/version/version_command.py,sha256=drxn12TSHxeD9pjT9dH5L8-0Xytejdn5cBbGR4CKRAQ,509
40
40
  cycode/cli/config.py,sha256=JR_-uZdWVV-AaffRqTbDH0V7O4KLGNKn50v3huuPlts,466
41
41
  cycode/cli/config.yaml,sha256=SBs5VNdaY9BVbRlwgnTF_j53GBbjJVwwBj9qx_qvrds,463
42
- cycode/cli/consts.py,sha256=eFndeCYSAW_g-BBtq9RKR-5gJY-wFi3fGsGc4PctBAc,6154
42
+ cycode/cli/consts.py,sha256=nFm3XpcGak7VNGTqDd-8OiBq4liroHo8vxmGx2L5lrw,6194
43
43
  cycode/cli/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
44
  cycode/cli/exceptions/custom_exceptions.py,sha256=xgTOP-R9bKewTy3VLgyr8knmNHdRbBrFIDg-_n0G9Hg,2109
45
45
  cycode/cli/exceptions/handle_report_sbom_errors.py,sha256=5F0C9D-5FQRme5uDqeTKu7pyDyHx7TnSybudgDdLsS8,1620
@@ -49,7 +49,7 @@ cycode/cli/files_collector/excluder.py,sha256=A40HqlFkmDJa1XAhSRaf2cz9bLxBO5WpNC
49
49
  cycode/cli/files_collector/iac/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
50
  cycode/cli/files_collector/iac/tf_content_generator.py,sha256=--dW_vLbw_-t6wYpKhHdBlbegFhiiPXfKiHGtHdh9LA,2457
51
51
  cycode/cli/files_collector/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
- cycode/cli/files_collector/models/in_memory_zip.py,sha256=pADqL5zoaaxEzMGjSRJ1M5w0-pWFIZFcbunWEZFJ7gQ,922
52
+ cycode/cli/files_collector/models/in_memory_zip.py,sha256=hZaP8Km5xw3_BVsjabx3uTebDvJLM_at3591QJUjedc,1247
53
53
  cycode/cli/files_collector/path_documents.py,sha256=DWP0D75urqUg00kC1opREjt_z6IhKYe6ROuV03HI5eM,4393
54
54
  cycode/cli/files_collector/repository_documents.py,sha256=aPPtTdxS0jrVOcULwzAB_T48RPq5Ypcrwso_04wwJCM,4940
55
55
  cycode/cli/files_collector/sca/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -58,7 +58,7 @@ cycode/cli/files_collector/sca/maven/base_restore_maven_dependencies.py,sha256=T
58
58
  cycode/cli/files_collector/sca/maven/restore_gradle_dependencies.py,sha256=KpzP-QR1X3fJemKye1bzLsnoKWKwTU22U_qOEjCt3BA,1136
59
59
  cycode/cli/files_collector/sca/maven/restore_maven_dependencies.py,sha256=k2giuUaJnYAD6LaN04jOqOMT-JB1mP8moyC369XvL7o,3119
60
60
  cycode/cli/files_collector/sca/sca_code_scanner.py,sha256=5pWrMiiGhYDHck9_DCOkFt4_690Y5huIA69Tg1DtYJc,6398
61
- cycode/cli/files_collector/zip_documents.py,sha256=N9ox2XV6y7zdVb7bdYHUxpBykrtU7_qmlHnq_AbcwRs,1522
61
+ cycode/cli/files_collector/zip_documents.py,sha256=epGAbO7M4d9qNwf-rdGbakVQfPmzaEqa7-5iBoQEiLE,1836
62
62
  cycode/cli/main.py,sha256=TWZxfs7nu-zSm1YU4H801T_u16xeV3S-gZcb4gSSD24,387
63
63
  cycode/cli/models.py,sha256=T2h7fYInJTrZnQo0xPf_JrMTBKbi73TnZlZI43nIDzY,2051
64
64
  cycode/cli/printers/__init__.py,sha256=ALwAXSZy2lNXWC3NfCIxf8K0F6eFrbZa9PLZwPINi5E,93
@@ -75,7 +75,7 @@ cycode/cli/printers/text_printer.py,sha256=kz6iswmKZRBU1J7csFg9sodk2n2BB4d9g5_OV
75
75
  cycode/cli/user_settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
76
  cycode/cli/user_settings/base_file_manager.py,sha256=VjWYvjZMfqh7SzWlJvv6el4UcqXzUgznjymg15XEeB0,630
77
77
  cycode/cli/user_settings/config_file_manager.py,sha256=PYn6MEaO63OJjN_bia8qMGYKG0m5L1Ubu-_MdWw1wU8,4939
78
- cycode/cli/user_settings/configuration_manager.py,sha256=-FZFcT3cVFs77v029c-szOLevmfLHSgkhgMoNvipP-0,7286
78
+ cycode/cli/user_settings/configuration_manager.py,sha256=qqp2SSMHRtG5EMi5McABYet8RWbofGZ9s3AaP49hBhk,7591
79
79
  cycode/cli/user_settings/credentials_manager.py,sha256=_oJTEjN6M9YsEy_q2NbTR7GaCcXCYgMsPonroyM7-N8,2987
80
80
  cycode/cli/user_settings/jwt_creator.py,sha256=xEkFLFqhwbNJnXuIi02XDxoj2E-4Nw-m10uJaHl3luA,745
81
81
  cycode/cli/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -103,7 +103,7 @@ cycode/cyclient/models.py,sha256=C8q_KFSdFRvUbhTSwCcDxhJEhxZIvZuEM_1z9O5fZRg,131
103
103
  cycode/cyclient/report_client.py,sha256=sNLOm64oaONz-TUBs6fpFfbb7RfxALPS6YBqadMo2-8,3971
104
104
  cycode/cyclient/scan_client.py,sha256=VA-snhiDGSvTZsI6QWa0gI3lK4lpwt9GbMpRnuGYark,13449
105
105
  cycode/cyclient/scan_config_base.py,sha256=d4yVzwqgc9bsf9Bd4qBKoThLOfkgHDYgLqaLuIeTbBk,1658
106
- cycode-1.9.3.dev2.dist-info/METADATA,sha256=kB2LziNNpmM6RpAsT8eWmi0TpC_gH7Uuh2fTqK2kvF4,44107
107
- cycode-1.9.3.dev2.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
108
- cycode-1.9.3.dev2.dist-info/entry_points.txt,sha256=GKZlS6LtUdABDPd7-o9bwNSI5gYQnyA3qGrFFQKt3Vc,51
109
- cycode-1.9.3.dev2.dist-info/RECORD,,
106
+ cycode-1.9.4.dev1.dist-info/METADATA,sha256=GWFnHppYcMdnS5DrlFZJC27LsnuJ0mX-TIaq1rm02kQ,44107
107
+ cycode-1.9.4.dev1.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
108
+ cycode-1.9.4.dev1.dist-info/entry_points.txt,sha256=GKZlS6LtUdABDPd7-o9bwNSI5gYQnyA3qGrFFQKt3Vc,51
109
+ cycode-1.9.4.dev1.dist-info/RECORD,,