Skip to content

Commit dfe764c

Browse files
committed
CM-60929-fix-max-bytes-read-from-file
1 parent 3cb04d4 commit dfe764c

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

cycode/cli/apps/ai_guardrails/scan/handlers.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,12 +345,10 @@ def _scan_path_for_secrets(ctx: typer.Context, file_path: str, policy: dict) ->
345345
if not file_path or not os.path.exists(file_path):
346346
return None, None
347347

348-
with open(file_path, encoding='utf-8', errors='replace') as f:
349-
content = f.read()
350-
351-
# Truncate content based on policy max_bytes
352348
max_bytes = get_policy_value(policy, 'secrets', 'max_bytes', default=200000)
353-
content = truncate_utf8(content, max_bytes)
349+
350+
with open(file_path, encoding='utf-8', errors='replace') as f:
351+
content = f.read(max_bytes)
354352

355353
# Get timeout from policy
356354
timeout_ms = get_policy_value(policy, 'secrets', 'timeout_ms', default=30000)

0 commit comments

Comments
 (0)