From 103782f72b6bd8cd8cc93f758e73aa7f812464a9 Mon Sep 17 00:00:00 2001 From: Urjit Singh Bhatia Date: Mon, 4 May 2020 14:37:30 -0700 Subject: [PATCH] Fix warning handling with changes to official master --- include/colors | 2 +- prowler | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/colors b/include/colors index 7bb9f84e..0c9a4435 100644 --- a/include/colors +++ b/include/colors @@ -68,6 +68,6 @@ fi printColorsCode(){ if [[ $MONOCHROME -eq 0 ]]; then echo -e "\n$NORMAL Colors code for results: " - echo -e "$NOTICE INFO (Information)$NORMAL,$OK PASS (Recommended value)$NORMAL, $BAD FAIL (Fix required)$NORMAL, $PURPLE Not Scored $NORMAL" + echo -e "$NOTICE INFO (Information)$NORMAL,$OK PASS (Recommended value)$NORMAL, $WARNING WARNING (Ignored by whitelist)$NORMAL, $BAD FAIL (Fix required)$NORMAL, $PURPLE Not Scored $NORMAL" fi } diff --git a/prowler b/prowler index 4a8d9d4f..eb1f1c53 100755 --- a/prowler +++ b/prowler @@ -234,7 +234,7 @@ REGIONS=$($AWSCLI ec2 describe-regions --query 'Regions[].RegionName' \ if [[ -n "$WHITELIST_FILE" ]]; then # ignore lines starting with # (comments) # ignore inline comments: check1:foo # inline comment - WHITELIST=$(awk '!/^[[:space:]]*#/{print }' <(cat "$WHITELIST_FILE") | sed 's/[[:space:]]*#.*$//g') + WHITELIST="$(awk '!/^[[:space:]]*#/{print }' <(cat "$WHITELIST_FILE") | sed 's/[[:space:]]*#.*$//g')" fi # Load all of the groups of checks inside groups folder named as "groupNumber*" @@ -313,6 +313,9 @@ execute_check() { ASFF_RESOURCE_TYPE="${!asff_resource_type_var:-AwsAccount}" # Generate the credential report, only if it is group1 related which checks we # run so that the checks can safely assume it's available + # set the custom ignores list for this check + ignores="$(awk "/${1}/{print}" <(echo "${WHITELIST}"))" + if [ ${alternate_name} ];then if [[ ${alternate_name} == check1* || ${alternate_name} == extra71 ]];then if [ ! -s $TEMP_REPORT_FILE ];then @@ -325,7 +328,7 @@ execute_check() { prepare_junit_check_output "$1" fi # Execute the check - ${alternate_name} + IGNORES="${ignores}" CHECK_NAME="$1" ${alternate_name} if is_junit_output_enabled; then finalise_junit_check_output "$1" fi @@ -341,8 +344,6 @@ execute_check() { fi fi show_check_title "$1" - # set the custom ignores list for this check - ignores=$(awk '/${1}/{print}' <(echo "${WHITELIST}")) if is_junit_output_enabled; then prepare_junit_check_output "$1" fi