From 558ea1c1b6d1a32eb20bfd96185f7806d3dcfd59 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Sat, 7 Oct 2023 13:17:46 +0200 Subject: [PATCH] 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: https://github.com/csutils/csmock/pull/128 --- py/csmock | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/py/csmock b/py/csmock index 6de5a4d..c38f736 100755 --- a/py/csmock +++ b/py/csmock @@ -764,6 +764,11 @@ key event (defaults to 3).") help="stop processing a warning if the count of its occurrences \ exceeds the specified limit (defaults to 1024).") + parser.add_argument( + "--limit-msg-len", type=int, default=512, + help="limit length of diagnostic messages by the specified number of chars \ +(defaults to 512).") + parser.add_argument( "-k", "--keep-going", action="store_true", help="continue as much as possible after an error") @@ -908,6 +913,9 @@ exceeds the specified limit (defaults to 1024).") if args.warning_rate_limit > 0: props.results_limits_opts += [f"--warning-rate-limit={args.warning_rate_limit}"] + if args.limit_msg_len > 0: + props.results_limits_opts += [f"--limit-msg-len={args.limit_msg_len}"] + if args.run_check: # run the %check section of specfile props.run_check = True