mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 14:55:00 +00:00
fix(include/outputs): Whitelist logic reformulated to exactly match input (#1029)
* fix(inlcude/outputs) Whitelist logic reformulated to exactly match input * fix(include/outputs): Changed name of iterative variable that browses whitelisted values * fix(include/outputs): Deleted missing echo and include and put variables in brackets
This commit is contained in:
@@ -167,18 +167,20 @@ textFail(){
|
||||
## ignore whitelists for current check
|
||||
level="FAIL"
|
||||
colorcode="$BAD"
|
||||
while read -r i; do
|
||||
ignore_check_name="${i%%:*}" # Check name is everything up to the first :
|
||||
ignore_value="${i#*${CHECK_NAME}:}" # Ignore value is everything after the first :
|
||||
# Check to see if ignore value appears anywhere within log message.
|
||||
resource_value=".*${ignore_value}.*"
|
||||
if [[ ${ignore_check_name} != "${CHECK_NAME}" ]]; then
|
||||
while read -r excluded_item; do
|
||||
ignore_check_name="${excluded_item%%:*}" # Check name is everything up to the first :
|
||||
# Resource value is the second field of line included in whitelist divided by :
|
||||
resource_value=$(awk -F ":" '{print $2}' <<< $excluded_item)
|
||||
# Checked value is the second field of log message divided by spaces
|
||||
checked_value=$(awk '{print $2}' <<< $1)
|
||||
if [[ "${ignore_check_name}" != "${CHECK_NAME}" ]]; then
|
||||
# not for this check
|
||||
continue
|
||||
fi
|
||||
if [[ $1 =~ ${resource_value} ]]; then
|
||||
# To set WARNING flag both values must be exactly the same
|
||||
if [[ "${checked_value}" == "${resource_value}" ]]; then
|
||||
level="WARNING"
|
||||
colorcode="$WARNING"
|
||||
colorcode="${WARNING}"
|
||||
break
|
||||
fi
|
||||
done <<< "$IGNORES"
|
||||
|
||||
Reference in New Issue
Block a user