From 0f3994a13580b700fb69451f99ce2d788f230631 Mon Sep 17 00:00:00 2001 From: Joaquin Rinaudo Date: Thu, 3 Sep 2020 08:05:49 +0200 Subject: [PATCH] fix(error-handling): security-hub --- include/securityhub_integration | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/securityhub_integration b/include/securityhub_integration index 3aa14860..30fd427e 100644 --- a/include/securityhub_integration +++ b/include/securityhub_integration @@ -58,7 +58,7 @@ sendToSecurityHub(){ BATCH_IMPORT_RESULT=$($AWSCLI securityhub --region "$region" $PROFILE_OPT batch-import-findings --findings "${findings}") # Check for success if imported - if [[ ! -z "${BATCH_IMPORT_RESULT}" ]] && ! jq -e '.SuccessCount == 1' <<< "${BATCH_IMPORT_RESULT}" > /dev/null 2>&1; then + if [[ -z "${BATCH_IMPORT_RESULT}" ]] || ! jq -e '.SuccessCount == 1' <<< "${BATCH_IMPORT_RESULT}" > /dev/null 2>&1; then echo -e "\n$RED ERROR!$NORMAL Failed to send check output to AWS Security Hub\n" fi