cycode 3.8.9.dev1__py3-none-any.whl → 3.8.10.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__ = '3.8.9.dev1' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
1
+ __version__ = '3.8.10.dev1' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
@@ -8,7 +8,7 @@ from cycode.cli.printers.tables.table_models import ColumnInfoBuilder
8
8
  from cycode.cli.printers.tables.table_printer_base import TablePrinterBase
9
9
  from cycode.cli.printers.utils import is_git_diff_based_scan
10
10
  from cycode.cli.printers.utils.detection_ordering.common_ordering import sort_and_group_detections_from_scan_result
11
- from cycode.cli.utils.string_utils import get_position_in_line, obfuscate_text
11
+ from cycode.cli.utils.string_utils import get_position_in_line, obfuscate_text, sanitize_text_for_encoding
12
12
 
13
13
  if TYPE_CHECKING:
14
14
  from cycode.cli.models import LocalScanResult
@@ -96,6 +96,8 @@ class TablePrinter(TablePrinterBase):
96
96
  if not self.show_secret:
97
97
  violation = obfuscate_text(violation)
98
98
 
99
+ violation = sanitize_text_for_encoding(violation)
100
+
99
101
  table.add_cell(LINE_NUMBER_COLUMN, str(detection_line))
100
102
  table.add_cell(COLUMN_NUMBER_COLUMN, str(detection_column))
101
103
  table.add_cell(VIOLATION_LENGTH_COLUMN, f'{violation_length} chars')
@@ -5,7 +5,7 @@ from rich.syntax import Syntax
5
5
  from cycode.cli import consts
6
6
  from cycode.cli.console import _SYNTAX_HIGHLIGHT_THEME
7
7
  from cycode.cli.printers.utils import is_git_diff_based_scan
8
- from cycode.cli.utils.string_utils import get_position_in_line, obfuscate_text
8
+ from cycode.cli.utils.string_utils import get_position_in_line, obfuscate_text, sanitize_text_for_encoding
9
9
 
10
10
  if TYPE_CHECKING:
11
11
  from cycode.cli.models import Document
@@ -72,6 +72,7 @@ def _get_code_snippet_syntax_from_file(
72
72
  code_lines_to_render.append(line_content)
73
73
 
74
74
  code_to_render = '\n'.join(code_lines_to_render)
75
+ code_to_render = sanitize_text_for_encoding(code_to_render)
75
76
  return _get_syntax_highlighted_code(
76
77
  code=code_to_render,
77
78
  lexer=Syntax.guess_lexer(document.path, code=code_to_render),
@@ -94,6 +95,7 @@ def _get_code_snippet_syntax_from_git_diff(
94
95
  violation = line_content[detection_position_in_line : detection_position_in_line + violation_length]
95
96
  line_content = line_content.replace(violation, obfuscate_text(violation))
96
97
 
98
+ line_content = sanitize_text_for_encoding(line_content)
97
99
  return _get_syntax_highlighted_code(
98
100
  code=line_content,
99
101
  lexer='diff',
@@ -5,6 +5,7 @@ from rich.markdown import Markdown
5
5
  from rich.panel import Panel
6
6
 
7
7
  from cycode.cli.console import console
8
+ from cycode.cli.utils.string_utils import sanitize_text_for_encoding
8
9
 
9
10
  if TYPE_CHECKING:
10
11
  from rich.console import RenderableType
@@ -20,8 +21,9 @@ def get_panel(renderable: 'RenderableType', title: str) -> Panel:
20
21
 
21
22
 
22
23
  def get_markdown_panel(markdown_text: str, title: str) -> Panel:
24
+ sanitized_text = sanitize_text_for_encoding(markdown_text.strip())
23
25
  return get_panel(
24
- Markdown(markdown_text.strip()),
26
+ Markdown(sanitized_text),
25
27
  title=title,
26
28
  )
27
29
 
@@ -65,3 +65,12 @@ def shortcut_dependency_paths(dependency_paths_list: str) -> str:
65
65
  result += '\n'
66
66
 
67
67
  return result.rstrip().rstrip(',')
68
+
69
+
70
+ def sanitize_text_for_encoding(text: str) -> str:
71
+ """Sanitize text by replacing surrogate characters and invalid UTF-8 sequences.
72
+
73
+ This prevents encoding errors when Rich tries to display the content, especially on Windows.
74
+ Surrogate characters (U+D800 to U+DFFF) cannot be encoded to UTF-8 and will cause errors.
75
+ """
76
+ return text.encode('utf-8', errors='replace').decode('utf-8')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cycode
3
- Version: 3.8.9.dev1
3
+ Version: 3.8.10.dev1
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=YUAcqHZPfQdMcwgHIWiChK0tE95pEpSaBR1Xf7REW1I,114
1
+ cycode/__init__.py,sha256=bCWClXXqkw-rOxqHYxMBz0EgWIHCXYBBc4jWWLB39YU,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=Th7skHthoJN1EuDtgjl4flflFqejfxaTORKmMKSXE00,6412
@@ -115,16 +115,16 @@ cycode/cli/printers/tables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
115
115
  cycode/cli/printers/tables/sca_table_printer.py,sha256=qdNZsmzWKcPDhw28WP_sw4BbH436eTvf3N_scgLDntg,6315
116
116
  cycode/cli/printers/tables/table.py,sha256=mdSUvAIGO2gMFvJxhkAJOrNzAh6x42BlqaZVAO127zA,2559
117
117
  cycode/cli/printers/tables/table_models.py,sha256=e8FBUD-XZHEarwwF632DFK9vpyPatcWMedyFe14kUtU,738
118
- cycode/cli/printers/tables/table_printer.py,sha256=1ICjI9IiOjYDAk-H6UKP2mL0YXLH8hKFXASGSI_lDm4,4606
118
+ cycode/cli/printers/tables/table_printer.py,sha256=8lYrjX_jaQrckOe7SSdIl6_uvyGbCsWaoxym8TTfhRQ,4693
119
119
  cycode/cli/printers/tables/table_printer_base.py,sha256=qCXn9ahV0ZeJ2MqxEeMhrecujoFgeLcmHjefyt5VrU4,1552
120
120
  cycode/cli/printers/text_printer.py,sha256=jx_URpXbDbd5NyZVOt44u0TkZW1wIHJX_vS8CEWkazE,5735
121
121
  cycode/cli/printers/utils/__init__.py,sha256=eTrDlfmd8LsaWk8D33kCbypPjYMBsE8-7TQ3SUMbrog,169
122
- cycode/cli/printers/utils/code_snippet_syntax.py,sha256=mNASDHsDbBW4LTZ8Sj8OBiwMLipdlR8wzPhvhk8pM0Q,4528
122
+ cycode/cli/printers/utils/code_snippet_syntax.py,sha256=2rfw1T3Nac-8gZFVlJLjceCMp3u3CHEx5xxLykBQGqY,4680
123
123
  cycode/cli/printers/utils/detection_data.py,sha256=gvBskEGEqq5qj0Zw-bDiYoc0JY6ThFkpM43zdwOmj9g,3522
124
124
  cycode/cli/printers/utils/detection_ordering/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
125
125
  cycode/cli/printers/utils/detection_ordering/common_ordering.py,sha256=WxdDGL9Hj8ne4sdWcmTjUIwWecOOJO7JE3baC9gSTzQ,2211
126
126
  cycode/cli/printers/utils/detection_ordering/sca_ordering.py,sha256=9qasDxNYiFKn1iXn6vqz2tuUpx0ad-Ayz2ai483oons,2315
127
- cycode/cli/printers/utils/rich_helpers.py,sha256=HhPVpxZNBR7qNB_06VbVdshrgAwUIry2nO2036m3Zd0,946
127
+ cycode/cli/printers/utils/rich_helpers.py,sha256=mUd9hIgZdRp0ZKfL26NHCrGdITKb2dvVtUSrYpZicck,1079
128
128
  cycode/cli/user_settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
129
129
  cycode/cli/user_settings/base_file_manager.py,sha256=SLA5xRMTqSY-PtbeKCtVc9rP_ljxUYe3z3ZU-XE2x0w,844
130
130
  cycode/cli/user_settings/config_file_manager.py,sha256=KqMogXjtgO-ZbEGW0eN_ZUHn3tLQFJteV8zYDgEhIks,4954
@@ -143,7 +143,7 @@ cycode/cli/utils/scan_batch.py,sha256=jIG3jPYBptcwPHcTze0goFs4etCAOyKahdhUNPBsuf
143
143
  cycode/cli/utils/scan_utils.py,sha256=PHmTTZKatUHeAA2d1GrfmAK_APO7yEZa4safdl6Cfxs,1110
144
144
  cycode/cli/utils/sentry.py,sha256=hHWYtiGKD6vRi8S6Jx9hycs5JpJvGlkBImXZfWfWB1o,3612
145
145
  cycode/cli/utils/shell_executor.py,sha256=CuHeXoYM6VaYtDernWtf49_s1EfuU8nWxj4MPIAciww,1290
146
- cycode/cli/utils/string_utils.py,sha256=jrZ5B7351hVEibHQzyrAqJJoP3R3jgpONNEw3wMAUVA,2032
146
+ cycode/cli/utils/string_utils.py,sha256=0kvu_apAfHjwd7dUhZl8k1pr57aCiO1MhzBYnA2keK4,2434
147
147
  cycode/cli/utils/task_timer.py,sha256=wxfM2TtJGjc1F17CIja_Qmt6zd4a1qdMwuz0ltgTDAg,2722
148
148
  cycode/cli/utils/url_utils.py,sha256=2ZhRCbQsKnvAl5MBugQ5CrwuALP8uivsCI6chlqxahM,2304
149
149
  cycode/cli/utils/version_checker.py,sha256=0f5PaTk02ZkDxzBqZOeMV9mU_CWcx6HKW80jUKFOOZs,8239
@@ -168,8 +168,8 @@ cycode/cyclient/report_client.py,sha256=Scq30NeJPzgXv0hPLO1U05AdE9i_2iu6cIrSKpEJ
168
168
  cycode/cyclient/scan_client.py,sha256=uTBEjgfaCVuJREo73p_zkIVA23NQfdJ1d1-bzc7nSKk,12682
169
169
  cycode/cyclient/scan_config_base.py,sha256=mXsPZGYCtp85rv5GIige40yQZXuRcEKUW-VQJ0vgFzk,1201
170
170
  cycode/logger.py,sha256=xAzpkWLZhixO4egRcYn4HXM9lIfx5wHdpkHxNc5jrX8,2225
171
- cycode-3.8.9.dev1.dist-info/METADATA,sha256=mHSNMZLjq-KJu1RTmGhCWU51fr99mewefFx0iCddCf8,79037
172
- cycode-3.8.9.dev1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
173
- cycode-3.8.9.dev1.dist-info/entry_points.txt,sha256=iDcVJM8ByLElVgvBgtYxDjw1kT7O8Mo0LcWZIT5L3Ig,45
174
- cycode-3.8.9.dev1.dist-info/licenses/LICENCE,sha256=2Wx4N6mD_4xB7-E3hPkZ3MPhpJy__k_I8MaCSO-PDRo,1068
175
- cycode-3.8.9.dev1.dist-info/RECORD,,
171
+ cycode-3.8.10.dev1.dist-info/METADATA,sha256=BqfBvM6qzxUh_hGWBlpKaLKpyUq44LC7zkj4tmetzns,79038
172
+ cycode-3.8.10.dev1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
173
+ cycode-3.8.10.dev1.dist-info/entry_points.txt,sha256=iDcVJM8ByLElVgvBgtYxDjw1kT7O8Mo0LcWZIT5L3Ig,45
174
+ cycode-3.8.10.dev1.dist-info/licenses/LICENCE,sha256=2Wx4N6mD_4xB7-E3hPkZ3MPhpJy__k_I8MaCSO-PDRo,1068
175
+ cycode-3.8.10.dev1.dist-info/RECORD,,