Skip to content

Commit

Permalink
Merge pull request #6562 from Checkmarx/kics-782-aws-pulumi
Browse files Browse the repository at this point in the history
feat(query): amazon rds db instance publicly accessible query for pulumi
  • Loading branch information
asofsilva authored Aug 10, 2023
2 parents b645681 + 35c3cee commit 58ec583
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"id": "647de8aa-5a42-41b5-9faf-22136f117380",
"queryName": "RDS DB Instance Publicly Accessible",
"severity": "HIGH",
"category": "Insecure Configurations",
"descriptionText": "RDS must not be defined with public interface, which means the attribute 'PubliclyAccessible' must be set to false.",
"descriptionUrl": "https://www.pulumi.com/registry/packages/aws/api-docs/rds/instance/#publiclyaccessible_yaml",
"platform": "Pulumi",
"descriptionID": "be6d13f0",
"cloudProvider": "aws"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package Cx

import data.generic.common as common_lib

CxPolicy[result] {
resource := input.document[i].resources[name]
resource.type == "aws:rds:Instance"
resource.properties.publiclyAccessible == true

result := {
"documentId": input.document[i].id,
"resourceType": resource.type,
"resourceName": name,
"searchKey": sprintf("resources[%s].properties.publiclyAccessible", [name]),
"issueType": "IncorrectValue",
"keyExpectedValue": sprintf("'resources.%s.properties.publiclyAccessible' should be set to 'false'", [name]),
"keyActualValue": sprintf("'resources.%s.properties.publiclyAccessible' is set to 'true'", [name]),
"searchLine": common_lib.build_search_line(["resources", name, "properties", "publiclyAccessible"], []),
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: aws-rds
runtime: yaml
description: An RDS cluster
resources:
default:
type: aws:rds:Instance
properties:
allocatedStorage: 10
dbName: mydb
engine: mysql
engineVersion: '5.7'
instanceClass: db.t3.micro
parameterGroupName: default.mysql5.7
password: foobarbaz
skipFinalSnapshot: true
username: foo
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: aws-rds
runtime: yaml
description: An RDS Instance
resources:
default:
type: aws:rds:Instance
properties:
allocatedStorage: 10
dbName: mydb
engine: mysql
engineVersion: '5.7'
instanceClass: db.t3.micro
parameterGroupName: default.mysql5.7
password: foobarbaz
skipFinalSnapshot: true
username: foo
publiclyAccessible: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: aws-rds
runtime: yaml
description: An RDS Instance
resources:
default:
type: aws:rds:Instance
properties:
allocatedStorage: 10
dbName: mydb
engine: mysql
engineVersion: '5.7'
instanceClass: db.t3.micro
parameterGroupName: default.mysql5.7
password: foobarbaz
skipFinalSnapshot: true
username: foo
publiclyAccessible: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"queryName": "RDS DB Instance Publicly Accessible",
"severity": "HIGH",
"line": 17,
"fileName": "positive1.yaml"
}
]

0 comments on commit 58ec583

Please sign in to comment.