From aa3edbc63657c605fb320505713bfbf47ec79a49 Mon Sep 17 00:00:00 2001 From: Pablo Pagani <79593935+pablopagani@users.noreply.github.com> Date: Wed, 9 Jun 2021 14:01:27 -0300 Subject: [PATCH] corrected bug on groups when listing checks corrected bug on groups when listing checks (option -l) Previous regular expression will include groups when it matched half of the check_id --- prowler | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/prowler b/prowler index e6075a09..b3cc2e09 100755 --- a/prowler +++ b/prowler @@ -330,16 +330,19 @@ show_check_title() { local check_servicename=CHECK_SERVICENAME_$1 local group_ids local group_index + local check_name # If requested ($2 is any non-null value) iterate all GROUP_CHECKS and produce a comma-separated list of all # the GROUP_IDs that include this particular check if [[ -n "$2" ]]; then for group_index in "${!GROUP_ID[@]}"; do - if [[ "${GROUP_CHECKS[$group_index]}" =~ "$1" ]]; then - if [[ -n "$group_ids" ]]; then - group_ids+=", " + for check_name in $(echo "${GROUP_CHECKS[$group_index]}" | sed "s/,/ /g");do + if [[ "$check_name" == "$1" ]]; then + if [[ -n "$group_ids" ]]; then + group_ids+=", " + fi + group_ids+="${GROUP_ID[$group_index]}" fi - group_ids+="${GROUP_ID[$group_index]}" - fi + done done fi # This shows ASFF_COMPLIANCE_TYPE if group used is ens, this si used to show ENS compliance ID control, can be used for other compliance groups as well.