fix(securityhub): add RecordState outputs

This commit is contained in:
Joaquin Rinaudo
2020-09-18 14:59:28 +02:00
parent c1b09b6b9d
commit b7c1823ec9

View File

@@ -112,13 +112,15 @@ textFail(){
level="FAIL"
colorcode="$BAD"
while read -r i; do
ignore_check_name="${i%:*}"
ignore_value="${i#*${CHECK_NAME}:}"
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
# not for this check
continue
fi
if [[ $1 =~ .*"${ignore_value}".* ]]; then
if [[ $1 =~ ${resource_value} ]]; then
level="WARNING"
colorcode="$WARNING"
break
@@ -274,7 +276,7 @@ generateJsonAsffOutput(){
"SchemaVersion": "2018-10-08",
"Id": "prowler-\($TITLE_ID)-\($ACCOUNT_NUM)-\($REPREGION)-\($UNIQUE_ID)",
"ProductArn": "arn:\($AWS_PARTITION):securityhub:\($REPREGION):\($ACCOUNT_NUM):product/\($ACCOUNT_NUM)/default",
"RecordState": "ACTIVE",
"RecordState": "ACTIVE"
"ProductFields": {
"ProviderName": "Prowler",
"ProviderVersion": $PROWLER_VERSION
@@ -282,7 +284,7 @@ generateJsonAsffOutput(){
"GeneratorId": "prowler-\($CHECK_ID)",
"AwsAccountId": $ACCOUNT_NUM,
"Types": [
"\($TYPE)-Policy:\($TITLE_TEXT)"
$TYPE
],
"FirstObservedAt": $TIMESTAMP,
"UpdatedAt": $TIMESTAMP,
@@ -357,4 +359,4 @@ generateHtmlOutput(){
echo '<td>'$message'</td>' >> ${OUTPUT_FILE_NAME}.$EXTENSION_HTML
echo '</tr>'>> ${OUTPUT_FILE_NAME}.$EXTENSION_HTML
fi
}
}