From 9b81fc0ac737d5070d4ba468a022c154b42542cc Mon Sep 17 00:00:00 2001 From: gabrielsoltz Date: Thu, 24 Oct 2019 23:30:34 +0200 Subject: [PATCH] fix jq array --- checks/check_extra73 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checks/check_extra73 b/checks/check_extra73 index e662c938..6ef96e7d 100644 --- a/checks/check_extra73 +++ b/checks/check_extra73 @@ -101,7 +101,7 @@ extra73(){ if [[ $BUCKET_POLICY_ALLOW_ALL_WITHOUT_CONDITION ]]; then # Let's do more magic and identify who can do what BUCKET_POLICY_ALLOW_ALL_WITHOUT_CONDITION_DETAILS=$($AWSCLI s3api get-bucket-policy $PROFILE_OPT --region $BUCKET_LOCATION --bucket $bucket \ - | jq '.Policy | fromjson' | jq '.Statement[] | select(.Effect=="Allow") | select(.Principal=="*" or .Principal.AWS=="*" or .Principal.CanonicalUser=="*") | select(has("Condition") | not)' | jq '"[Principal: " + (.Principal|tostring) + " Action: " + .Action + "]"' ) + | jq '.Policy | fromjson' | jq '.Statement[] | select(.Effect=="Allow") | select(.Principal=="*" or .Principal.AWS=="*" or .Principal.CanonicalUser=="*") | select(has("Condition") | not)' | jq '"[Principal: " + (.Principal|tostring) + " Action: " + (.Action|tostring) + "]"' ) S3_FINDING_POLICY="bucket policy allow perform actions: $BUCKET_POLICY_ALLOW_ALL_WITHOUT_CONDITION_DETAILS" else textPass "$BUCKET_LOCATION: $bucket bucket policy with conditions" "$BUCKET_LOCATION"