Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7eac3f2
fix(query): fn for DynamoDB Table Not Encrypted-cloudformation/aws pl…
cx-andre-pereira Jul 24, 2025
f21ca15
Cloudformation/aws_bom
cx-andre-pereira Jul 24, 2025
55686af
Cloudformation/aws_sam
cx-andre-pereira Jul 24, 2025
c9edd41
github guardian FN fix_1
cx-andre-pereira Jul 24, 2025
843f4ea
Merge branch 'master' into AST-40783--FN_CloudFormation_Boolean_Logic…
cx-andre-pereira Jul 24, 2025
bdf34f4
fix for expected results 1
cx-andre-pereira Jul 25, 2025
eed1d3e
Merge branch 'AST-40783--FN_CloudFormation_Boolean_Logic_Update--clou…
cx-andre-pereira Jul 25, 2025
f818074
Merge branch 'master' into AST-40783--FN_CloudFormation_Boolean_Logic…
cx-andre-pereira Jul 25, 2025
5cbea1a
Merge branch 'master' into AST-40783--FN_CloudFormation_Boolean_Logic…
cx-artur-ribeiro Aug 6, 2025
baf2e48
Merge branch 'master' of https://github.com/Checkmarx/kics into AST-4…
cx-ricardo-jesus Aug 6, 2025
6936acd
Merge branch 'master' of https://github.com/Checkmarx/kics into AST-4…
cx-ricardo-jesus Aug 20, 2025
a665cf0
query implementation for CloudFormation/AWS
cx-ricardo-jesus Aug 20, 2025
31f01ee
query implementation for terraform
cx-ricardo-jesus Aug 20, 2025
067154e
added samples for terraform implementation
cx-ricardo-jesus Aug 20, 2025
e6ba35c
query fully implemented for terraform/aws
cx-ricardo-jesus Aug 20, 2025
76d798b
added extra samples for cloudFormation
cx-ricardo-jesus Aug 20, 2025
a52e63a
Merge branch 'master' of https://github.com/Checkmarx/kics into AST-4…
cx-ricardo-jesus Aug 20, 2025
e1d02a0
fixed valid_for_iam_engine_and_version_check function on common_lib
cx-ricardo-jesus Aug 20, 2025
743c829
Merge branch 'master' into AST-40745
cx-artur-ribeiro Aug 22, 2025
c8e65a2
Merge branch 'master' into AST-40745
cx-artur-ribeiro Aug 22, 2025
38ca6a8
Merge branch 'master' into AST-40745
cx-artur-ribeiro Aug 22, 2025
ed2e898
Merge branch 'master' of https://github.com/Checkmarx/kics into AST-4…
cx-ricardo-jesus Aug 22, 2025
d9cd66e
fixed typo and samples added for terraform query
cx-ricardo-jesus Aug 22, 2025
3e75e15
added samples for CloudFormation
cx-ricardo-jesus Aug 22, 2025
b87c84a
Merge branch 'AST-40745' of https://github.com/Checkmarx/kics into AS…
cx-ricardo-jesus Aug 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion assets/libraries/common.rego
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,8 @@ weakCipher(aux) {
valid_for_iam_engine_and_version_check(resource, engineVar, engineVersionVar, instanceClassVar) {
key_list := [engineVar, engineVersionVar]
contains(lower(resource[engineVar]), "mariadb")
version_check := {x | x := resource[key_list[_]]; contains(x, "10.6")}
supported_versions := {"10.6", "10.11", "11.4"}
version_check := {x | x := resource[key_list[_]]; contains(x, supported_versions[_])}
count(version_check) > 0
} else {
engines_that_supports_iam := ["aurora-postgresql", "postgres", "mysql", "mariadb"]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"id": "6282794f-def8-4d6f-9df6-289318aa42b8",
"queryName": "IAM DB Cluster Auth Not Enabled",
"severity": "MEDIUM",
"category": "Access Control",
"descriptionText": "IAM Authentication should be enabled to verify the access of users and applications to your databases by enabling IAM policies and multi-factor authentication. This is a safety measure to ensure the protection of newly created databases without the proper IAM policies or in the change of policies in existing databases.",
"descriptionUrl": "https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-enableiamdatabaseauthentication",
"platform": "CloudFormation",
"descriptionID": "6282794f",
"cloudProvider": "aws",
"cwe": "311"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package Cx

import data.generic.cloudformation as cf_lib
import data.generic.common as common_lib

CxPolicy[result] {
docs := input.document[i]
[path, Resources] := walk(docs)
resource := Resources[name]
resource.Type == "AWS::RDS::DBCluster"

not common_lib.valid_key(resource.Properties, "EnableIAMDatabaseAuthentication")
valid_for_iam_engine_and_version_check_edited(resource.Properties, "Engine", "EngineVersion")

result := {
"documentId": input.document[i].id,
"resourceType": resource.Type,
"resourceName": cf_lib.get_resource_name(resource, name),
"searchKey": sprintf("Resources.%s.Properties", [name]),
"issueType": "MissingAttribute",
"keyExpectedValue": sprintf("'Resources.%s.Properties.EnableIAMDatabaseAuthentication' should be defined (disabled by default)", [name]),
"keyActualValue": sprintf("'Resources.%s.Properties.EnableIAMDatabaseAuthentication' is not defined (disabled by default)", [name]),
"searchLine": common_lib.build_search_line(["Resources", name, "Properties"], []),
}
}

CxPolicy[result] {
docs := input.document[i]
[path, Resources] := walk(docs)
resource := Resources[name]
resource.Type == "AWS::RDS::DBCluster"

common_lib.valid_key(resource.Properties, "EnableIAMDatabaseAuthentication")
cf_lib.isCloudFormationFalse(resource.Properties.EnableIAMDatabaseAuthentication)
valid_for_iam_engine_and_version_check_edited(resource.Properties, "Engine", "EngineVersion")

result := {
"documentId": input.document[i].id,
"resourceType": resource.Type,
"resourceName": cf_lib.get_resource_name(resource, name),
"searchKey": sprintf("Resources.%s.Properties.EnableIAMDatabaseAuthentication", [name]),
"issueType": "IncorrectValue",
"keyExpectedValue": sprintf("'Resources.%s.Properties.EnableIAMDatabaseAuthentication' should be defined to true", [name]),
"keyActualValue": sprintf("'Resources.%s.Properties.EnableIAMDatabaseAuthentication' is defined to false", [name]),
"searchLine": common_lib.build_search_line(["Resources", name, "Properties", "EnableIAMDatabaseAuthentication"], [])
}
}

valid_for_iam_engine_and_version_check_edited(resource, engineVar, engineVersionVar) {
key_list := [engineVar, engineVersionVar]
contains(lower(resource[engineVar]), "mariadb")
supported_versions := {"10.6", "10.11", "11.4"}
version_check := {x | x := resource[key_list[_]]; contains(x, supported_versions[_])}
count(version_check) > 0
} else {
engines_that_support_iam := ["aurora-postgresql", "postgres", "mysql", "mariadb"]
contains(lower(resource[engineVar]), engines_that_support_iam[_])
not common_lib.valid_key(resource, engineVersionVar)
} else {
engines_that_supports_iam := ["aurora-postgresql", "postgres", "mysql"]
contains(lower(resource[engineVar]), engines_that_supports_iam[_])
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
AWSTemplateFormatVersion: "2010-09-09"
Resources:
sample:
Type: 'AWS::RDS::DBCluster'
Properties:
MasterUsername: !Ref DBUsername
MasterUserPassword: !Ref DBPassword
StorageEncrypted: true
DBClusterIdentifier: aurora-postgresql-cluster
Engine: aurora-postgresql
EngineVersion: '10.7'
DBClusterParameterGroupName: default.aurora-postgresql10
EnableCloudwatchLogsExports:
- postgresql
EnableIAMDatabaseAuthentication: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"PostgresDBCluster": {
"Type": "AWS::RDS::DBCluster",
"Properties": {
"MasterUsername": {
"Ref": "DBUsername"
},
"MasterUserPassword": {
"Ref": "DBPassword"
},
"StorageEncrypted": true,
"DBClusterIdentifier": "postgres-db-cluster",
"Engine": "postgres",
"EngineVersion": "15.5",
"DBClusterParameterGroupName": "default.postgres15",
"EnableCloudwatchLogsExports": [
"postgresql"
],
"EnableIAMDatabaseAuthentication": true
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
AWSTemplateFormatVersion: "2010-09-09"
Resources:
PostgresDBCluster:
Type: "AWS::RDS::DBCluster"
Properties:
MasterUsername: !Ref DBUsername
MasterUserPassword: !Ref DBPassword
StorageEncrypted: "true"
DBClusterIdentifier: postgres-db-cluster
Engine: postgres
EngineVersion: "15.5"
DBClusterParameterGroupName: default.postgres15
EnableCloudwatchLogsExports:
- postgresql
EnableIAMDatabaseAuthentication: "true"
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"PostgresDBCluster": {
"Type": "AWS::RDS::DBCluster",
"Properties": {
"MasterUsername": {
"Ref": "DBUsername"
},
"MasterUserPassword": {
"Ref": "DBPassword"
},
"StorageEncrypted": "true",
"DBClusterIdentifier": "postgres-db-cluster",
"Engine": "postgres",
"EngineVersion": "15.5",
"DBClusterParameterGroupName": "default.postgres15",
"EnableCloudwatchLogsExports": [
"postgresql"
],
"EnableIAMDatabaseAuthentication": "true"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
AWSTemplateFormatVersion: "2010-09-09"
Resources:
PostgresDBCluster:
Type: "AWS::RDS::DBCluster"
Properties:
MasterUsername: !Ref DBUsername
MasterUserPassword: !Ref DBPassword
StorageEncrypted: true
DBClusterIdentifier: postgres-db-cluster
Engine: postgres
DBClusterParameterGroupName: default.postgres15
EnableCloudwatchLogsExports:
- postgresql
EnableIAMDatabaseAuthentication: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"PostgresDBCluster": {
"Type": "AWS::RDS::DBCluster",
"Properties": {
"MasterUsername": {
"Ref": "DBUsername"
},
"MasterUserPassword": {
"Ref": "DBPassword"
},
"StorageEncrypted": true,
"DBClusterIdentifier": "postgres-db-cluster",
"Engine": "postgres",
"DBClusterParameterGroupName": "default.postgres15",
"EnableCloudwatchLogsExports": [
"postgresql"
],
"EnableIAMDatabaseAuthentication": true
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
AWSTemplateFormatVersion: "2010-09-09"
Resources:
PostgresDBCluster:
Type: "AWS::RDS::DBCluster"
Properties:
MasterUsername: !Ref DBUsername
MasterUserPassword: !Ref DBPassword
StorageEncrypted: "true"
DBClusterIdentifier: postgres-db-cluster
Engine: postgres
DBClusterParameterGroupName: default.postgres15
EnableCloudwatchLogsExports:
- postgresql
EnableIAMDatabaseAuthentication: "true"
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"PostgresDBCluster": {
"Type": "AWS::RDS::DBCluster",
"Properties": {
"MasterUsername": {
"Ref": "DBUsername"
},
"MasterUserPassword": {
"Ref": "DBPassword"
},
"StorageEncrypted": "true",
"DBClusterIdentifier": "postgres-db-cluster",
"Engine": "postgres",
"DBClusterParameterGroupName": "default.postgres15",
"EnableCloudwatchLogsExports": [
"postgresql"
],
"EnableIAMDatabaseAuthentication": "true"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"sample": {
"Type": "AWS::RDS::DBCluster",
"Properties": {
"MasterUsername": {
"Ref": "DBUsername"
},
"MasterUserPassword": {
"Ref": "DBPassword"
},
"StorageEncrypted": true,
"DBClusterIdentifier": "aurora-postgresql-cluster",
"Engine": "aurora-postgresql",
"EngineVersion": "10.7",
"DBClusterParameterGroupName": "default.aurora-postgresql10",
"EnableCloudwatchLogsExports": [
"postgresql"
],
"EnableIAMDatabaseAuthentication": true
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
AWSTemplateFormatVersion: "2010-09-09"
Resources:
sample:
Type: 'AWS::RDS::DBCluster'
Properties:
MasterUsername: !Ref DBUsername
MasterUserPassword: !Ref DBPassword
StorageEncrypted: true
DBClusterIdentifier: aurora-postgresql-cluster
Engine: aurora-postgresql
EngineVersion: '10.7'
DBClusterParameterGroupName: default.aurora-postgresql10
EnableCloudwatchLogsExports:
- postgresql
EnableIAMDatabaseAuthentication: "true"
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"sample": {
"Type": "AWS::RDS::DBCluster",
"Properties": {
"MasterUsername": {
"Ref": "DBUsername"
},
"MasterUserPassword": {
"Ref": "DBPassword"
},
"StorageEncrypted": true,
"DBClusterIdentifier": "aurora-postgresql-cluster",
"Engine": "aurora-postgresql",
"EngineVersion": "10.7",
"DBClusterParameterGroupName": "default.aurora-postgresql10",
"EnableCloudwatchLogsExports": [
"postgresql"
],
"EnableIAMDatabaseAuthentication": "true"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
AWSTemplateFormatVersion: "2010-09-09"
Resources:
sample:
Type: 'AWS::RDS::DBCluster'
Properties:
MasterUsername: !Ref DBUsername
MasterUserPassword: !Ref DBPassword
StorageEncrypted: true
DBClusterIdentifier: !Ref SourceDBInstanceIdentifier
Engine: mariadb
EngineVersion: '10.5'
DBClusterParameterGroupName: default.aurora-postgresql10
EnableCloudwatchLogsExports:
- postgresql
EnableIAMDatabaseAuthentication: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"sample": {
"Type": "AWS::RDS::DBCluster",
"Properties": {
"MasterUsername": {
"Ref": "DBUsername"
},
"MasterUserPassword": {
"Ref": "DBPassword"
},
"StorageEncrypted": true,
"DBClusterIdentifier": {
"Ref": "SourceDBInstanceIdentifier"
},
"Engine": "mariadb",
"EngineVersion": "10.5",
"DBClusterParameterGroupName": "default.aurora-postgresql10",
"EnableCloudwatchLogsExports": [
"postgresql"
],
"EnableIAMDatabaseAuthentication": true
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
AWSTemplateFormatVersion: "2010-09-09"
Resources:
sample:
Type: 'AWS::RDS::DBCluster'
Properties:
MasterUsername: !Ref DBUsername
MasterUserPassword: !Ref DBPassword
StorageEncrypted: "true"
DBClusterIdentifier: !Ref SourceDBInstanceIdentifier
Engine: mariadb
EngineVersion: '10.5'
DBClusterParameterGroupName: default.aurora-postgresql10
EnableCloudwatchLogsExports:
- postgresql
EnableIAMDatabaseAuthentication: "true"
Loading
Loading