Fix security-hub integration: Race condition timestamp xeroxnir

Fix(security-hub): Race condition timestamp
This commit is contained in:
Toni de la Fuente
2020-09-18 18:19:50 +02:00
committed by GitHub

View File

@@ -14,6 +14,8 @@
# Checks that the correct mode (json-asff) has been specified if wanting to send check output to AWS Security Hub # Checks that the correct mode (json-asff) has been specified if wanting to send check output to AWS Security Hub
# and that Security Hub is enabled in the chosen region # and that Security Hub is enabled in the chosen region
checkSecurityHubCompatibility(){ checkSecurityHubCompatibility(){
OLD_TIMESTAMP=$(get_iso8601_one_minute_ago)
local regx local regx
if [[ "${MODE}" != "json-asff" ]]; then if [[ "${MODE}" != "json-asff" ]]; then
echo -e "\n$RED ERROR!$NORMAL Output can only be sent to Security Hub when the output mode is json-asff, i.e. -M json-asff -S\n" echo -e "\n$RED ERROR!$NORMAL Output can only be sent to Security Hub when the output mode is json-asff, i.e. -M json-asff -S\n"
@@ -35,7 +37,6 @@ resolveSecurityHubPreviousFails(){
for regx in $REGIONS; do for regx in $REGIONS; do
local check="$1" local check="$1"
OLD_TIMESTAMP=$(get_iso8601_one_minute_ago)
NEW_TIMESTAMP=$(get_iso8601_timestamp) NEW_TIMESTAMP=$(get_iso8601_timestamp)
PREVIOUS_DATE=$(get_iso8601_hundred_days_ago) PREVIOUS_DATE=$(get_iso8601_hundred_days_ago)