Skip to content

Commit e1a8936

Browse files
committed
csmock --limit-msg-len: limit length of diagnostic messages
... defaulting to 512 to avoid resource exhaustion on scans that go wild. Reproducer: ``` $ csmock -r rhel-7-x86_64 -f nss-util-3.90.0-1.el7_9.src.rpm -t gitleaks ``` Resolves: https://issues.redhat.com/browse/OSH-67 Closes: #128
1 parent a108242 commit e1a8936

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

py/csmock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,11 @@ key event (defaults to 3).")
764764
help="stop processing a warning if the count of its occurrences \
765765
exceeds the specified limit (defaults to 1024).")
766766

767+
parser.add_argument(
768+
"--limit-msg-len", type=int, default=512,
769+
help="limit length of diagnostic messages by the specified number of chars \
770+
(defaults to 512).")
771+
767772
parser.add_argument(
768773
"-k", "--keep-going", action="store_true",
769774
help="continue as much as possible after an error")
@@ -908,6 +913,9 @@ exceeds the specified limit (defaults to 1024).")
908913
if args.warning_rate_limit > 0:
909914
props.results_limits_opts += [f"--warning-rate-limit={args.warning_rate_limit}"]
910915

916+
if args.limit_msg_len > 0:
917+
props.results_limits_opts += [f"--limit-msg-len={args.limit_msg_len}"]
918+
911919
if args.run_check:
912920
# run the %check section of specfile
913921
props.run_check = True

0 commit comments

Comments
 (0)