inspec / inspec-aws

InSpec AWS Resource Pack https://www.inspec.io/
Other
133 stars 106 forks source link

updated inline policy criteria #948

Closed Jiaming1826 closed 1 year ago

Jiaming1826 commented 1 year ago

Signed-off-by: Jiaming Wang jiaming.wang@sap.com

Description

Updated has_statement? function of aws_iam_inline_policy.rb. For Action and NotAction, if they are arrays (see screenshot below), will use include? to check if there's any match to criteria[:Action]/criteria[:NotAction]. If they are not arrays, will use eql? to check if the statement and criteria match exactly.

image

Issues Resolved

The current resource pack would generate false alert because of the criteria check logics. For example, if the criteria is set as {Resource: '*', Action: '*', Effect: 'Allow'} to check if the inline policy authorizes any actions to any resources. However, an inline policy with any action includes * will also fail the check, such as the one in the above screenshot.

Check List

Please fill box or appropriate ([x]) or mark N/A.

netlify[bot] commented 1 year ago

Deploy Preview for inspec-aws canceled.

Name Link
Latest commit efca9000b5d655bf0f355ef98a05ab521aea7c69
Latest deploy log https://app.netlify.com/sites/inspec-aws/deploys/63205098d037a600085f4aa3