mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 14:55:00 +00:00
Fix bug getting policy versions
When serveral policies have the same full word substring, getting the policy versions can return multiple entries. Now fixed.
This commit is contained in:
2
prowler
2
prowler
@@ -856,7 +856,7 @@ check124(){
|
|||||||
if [[ $LIST_CUSTOM_POLICIES ]]; then
|
if [[ $LIST_CUSTOM_POLICIES ]]; then
|
||||||
textNotice "Looking for custom policies: (skipping default policies - it may take few seconds...)"
|
textNotice "Looking for custom policies: (skipping default policies - it may take few seconds...)"
|
||||||
for policy in $LIST_CUSTOM_POLICIES; do
|
for policy in $LIST_CUSTOM_POLICIES; do
|
||||||
POLICY_VERSION=$($AWSCLI iam list-policies $PROFILE_OPT --region $REGION --query 'Policies[*].[Arn,DefaultVersionId]' --output text|grep -w $policy |awk '{ print $2}')
|
POLICY_VERSION=$($AWSCLI iam list-policies $PROFILE_OPT --region $REGION --query 'Policies[*].[Arn,DefaultVersionId]' --output text |awk "\$1 == \"$policy\" { print \$2 }")
|
||||||
POLICY_WITH_FULL=$($AWSCLI iam get-policy-version --output text --policy-arn $policy --version-id $POLICY_VERSION --query "PolicyVersion.Document.Statement[?Effect == 'Allow' && contains(Resource, '*') && contains (Action, '*')]" $PROFILE_OPT --region $REGION)
|
POLICY_WITH_FULL=$($AWSCLI iam get-policy-version --output text --policy-arn $policy --version-id $POLICY_VERSION --query "PolicyVersion.Document.Statement[?Effect == 'Allow' && contains(Resource, '*') && contains (Action, '*')]" $PROFILE_OPT --region $REGION)
|
||||||
if [[ $POLICY_WITH_FULL ]]; then
|
if [[ $POLICY_WITH_FULL ]]; then
|
||||||
POLICIES_ALLOW_LIST="$POLICIES_ALLOW_LIST $policy"
|
POLICIES_ALLOW_LIST="$POLICIES_ALLOW_LIST $policy"
|
||||||
|
|||||||
Reference in New Issue
Block a user