Skip to content

Commit

Permalink
csmock --limit-msg-len: limit length of diagnostic messages
Browse files Browse the repository at this point in the history
... 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
  • Loading branch information
kdudka committed Oct 7, 2023
1 parent 68bd512 commit c01f9d1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions py/csmock
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c01f9d1

Please sign in to comment.