From 7e4afe3febe433dc78c8156fbacf446f618561c0 Mon Sep 17 00:00:00 2001 From: Max Amelchenko Date: Mon, 25 Mar 2024 08:24:51 +0200 Subject: [PATCH] fix too long lines in core scan.py (#199) Co-authored-by: Max Amelchenko --- detect_secrets/core/scan.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/detect_secrets/core/scan.py b/detect_secrets/core/scan.py index 371079ec2..f493fbde0 100644 --- a/detect_secrets/core/scan.py +++ b/detect_secrets/core/scan.py @@ -34,6 +34,7 @@ from detect_secrets.plugins.base import BasePlugin MIN_LINE_LENGTH = int(os.getenv('CHECKOV_MIN_LINE_LENGTH', '5')) +MAX_LINE_LENGTH = int(os.getenv('CHECKOV_MAX_LINE_LENGTH', '100000')) @lru_cache(maxsize=1) @@ -346,8 +347,8 @@ def _process_line_based_plugins( for line_number, line, is_added, is_removed in lines: line = line.strip() index += 1 - if len(line) < MIN_LINE_LENGTH: - # skip lines which have too few none whitespace chars + if len(line) < MIN_LINE_LENGTH or len(line) > MAX_LINE_LENGTH: + # skip lines which have too few or too many none whitespace chars continue if not is_added and not is_removed: