Skip to content

Commit

Permalink
Merge pull request #6553 from Checkmarx/kics/945
Browse files Browse the repository at this point in the history
fix(query): iam_access_analyzer_not_enabled
  • Loading branch information
asofsilva committed Nov 6, 2023
2 parents 82e20dd + 9eddcb2 commit 8d7fc79
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import data.generic.common as common_lib
extensions := {".json", ".yaml"}

CxPolicy[result] {
count({i | resources := input.document[i].Resources; resources[_].Type == "AWS::AccessAnalyzer::Analyzer"}) == 0

resources := input.document[i].Resources;
count(resources) > 0
count({i | resources[_].Type == "AWS::AccessAnalyzer::Analyzer"}) == 0

result := {
"documentId": input.document[i].id,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"Analyzer": {
"Type": "AWS::AccessAnalyzer::Analyzer",
"Properties": {
"AnalyzerName": "MyAccountAnalyzer",
"Type": "ACCOUNT",
"Tags": [
{
"Key": "Kind",
"Value": "Dev"
}
],
"ArchiveRules": [
{
"RuleName": "ArchiveTrustedAccountAccess",
"Filter": [
{
"Property": "principal.AWS",
"Eq": [
"123456789012"
]
}
]
},
{
"RuleName": "ArchivePublicS3BucketsAccess",
"Filter": [
{
"Property": "resource",
"Contains": [
"arn:aws:s3:::docs-bucket",
"arn:aws:s3:::clients-bucket"
]
}
]
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "A sample template 2",
"Resources": {
"myuseeer": {
"Type": "AWS::IAM::Group",
"Properties": {
"Path": "/",
"LoginProfile": {
"Password": "myP@ssW0rd"
}
}
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@
"severity": "LOW",
"line": 3,
"fileName": "positive1.yaml"
},
{
"queryName": "IAM Access Analyzer Not Enabled",
"severity": "LOW",
"line": 4,
"fileName": "positive2.json"
}
]

0 comments on commit 8d7fc79

Please sign in to comment.