From 0f3f25135c0a266c8526f7027b5cb93cff95e424 Mon Sep 17 00:00:00 2001 From: Felipe Avelar Date: Fri, 6 May 2022 03:13:30 +0100 Subject: [PATCH 1/2] fix(query): uncomment cloud formation's test sample Signed-off-by: Felipe Avelar --- .../test/negative1.yaml | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/assets/queries/cloudFormation/aws/iam_access_analyzer_not_enabled/test/negative1.yaml b/assets/queries/cloudFormation/aws/iam_access_analyzer_not_enabled/test/negative1.yaml index b01d32d8a42..e1e73b6fa39 100644 --- a/assets/queries/cloudFormation/aws/iam_access_analyzer_not_enabled/test/negative1.yaml +++ b/assets/queries/cloudFormation/aws/iam_access_analyzer_not_enabled/test/negative1.yaml @@ -1,24 +1,24 @@ -#AWSTemplateFormatVersion: 2010-09-09 -#Resources: -# Analyzer: -# Type: "AWS::AccessAnalyzer::Analyzer" -# Properties: -# AnalyzerName: MyAccountAnalyzer -# Type: ACCOUNT -# Tags: -# - Key: Kind -# Value: Dev -# ArchiveRules: +AWSTemplateFormatVersion: 2010-09-09 +Resources: + Analyzer: + Type: "AWS::AccessAnalyzer::Analyzer" + Properties: + AnalyzerName: MyAccountAnalyzer + Type: ACCOUNT + Tags: + - Key: Kind + Value: Dev + ArchiveRules: # Archive findings for a trusted AWS account -# RuleName: ArchiveTrustedAccountAccess -# Filter: -# - Property: "principal.AWS" -# Eq: -# - "123456789012" + RuleName: ArchiveTrustedAccountAccess + Filter: + - Property: "principal.AWS" + Eq: + - "123456789012" # Archive findings for known public S3 buckets -# RuleName: ArchivePublicS3BucketsAccess -# Filter: -# - Property: "resource" -# Contains: -# - "arn:aws:s3:::docs-bucket" -# - "arn:aws:s3:::clients-bucket" + RuleName: ArchivePublicS3BucketsAccess + Filter: + - Property: "resource" + Contains: + - "arn:aws:s3:::docs-bucket" + - "arn:aws:s3:::clients-bucket" From 428ba52cc7cff8305b8eb3e15799901e8699f12c Mon Sep 17 00:00:00 2001 From: Felipe Avelar Date: Thu, 16 Jun 2022 22:49:58 +0100 Subject: [PATCH 2/2] add suggested changes Signed-off-by: Felipe Avelar --- .../test/file.json | 25 ----------- .../test/negative1.yaml | 44 +++++++++---------- 2 files changed, 22 insertions(+), 47 deletions(-) delete mode 100644 assets/queries/cloudFormation/aws/iam_access_analyzer_not_enabled/test/file.json diff --git a/assets/queries/cloudFormation/aws/iam_access_analyzer_not_enabled/test/file.json b/assets/queries/cloudFormation/aws/iam_access_analyzer_not_enabled/test/file.json deleted file mode 100644 index 3ffb171aff6..00000000000 --- a/assets/queries/cloudFormation/aws/iam_access_analyzer_not_enabled/test/file.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "AWSTemplateFormatVersion": "2010-09-09", - "Description": "A sample template", - "Resources": { - "myuseeer2": { - "Type": "AWS::IAM::Group", - "Properties": { - "Path": "/", - "LoginProfile": { - "Password": "myP@ssW0rd" - } - } - }, - "IamUserAdminSample222": { - "Type": "AWS::IAM::User", - "Condition": "IsSampleIamUser", - "Properties": { - "UserName": "sample-iam-user-admin", - "Groups": [ - "myu2ser" - ] - } - } - } -} diff --git a/assets/queries/cloudFormation/aws/iam_access_analyzer_not_enabled/test/negative1.yaml b/assets/queries/cloudFormation/aws/iam_access_analyzer_not_enabled/test/negative1.yaml index e1e73b6fa39..9cbcfa408ac 100644 --- a/assets/queries/cloudFormation/aws/iam_access_analyzer_not_enabled/test/negative1.yaml +++ b/assets/queries/cloudFormation/aws/iam_access_analyzer_not_enabled/test/negative1.yaml @@ -1,24 +1,24 @@ AWSTemplateFormatVersion: 2010-09-09 Resources: - Analyzer: - Type: "AWS::AccessAnalyzer::Analyzer" - Properties: - AnalyzerName: MyAccountAnalyzer - Type: ACCOUNT - Tags: - - Key: Kind - Value: Dev - ArchiveRules: -# Archive findings for a trusted AWS account - RuleName: ArchiveTrustedAccountAccess - Filter: - - Property: "principal.AWS" - Eq: - - "123456789012" -# Archive findings for known public S3 buckets - RuleName: ArchivePublicS3BucketsAccess - Filter: - - Property: "resource" - Contains: - - "arn:aws:s3:::docs-bucket" - - "arn:aws:s3:::clients-bucket" + Analyzer: + Type: "AWS::AccessAnalyzer::Analyzer" + Properties: + AnalyzerName: MyAccountAnalyzer + Type: ACCOUNT + Tags: + - Key: Kind + Value: Dev + ArchiveRules: + - # Archive findings for a trusted AWS account + RuleName: ArchiveTrustedAccountAccess + Filter: + - Property: "principal.AWS" + Eq: + - "123456789012" + - # Archive findings for known public S3 buckets + RuleName: ArchivePublicS3BucketsAccess + Filter: + - Property: "resource" + Contains: + - "arn:aws:s3:::docs-bucket" + - "arn:aws:s3:::clients-bucket"