-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cloud): add the DeletionProtection attribute to the RDS Cluster #1443
Merged
simar7
merged 5 commits into
aquasecurity:master
from
dorayakikun:feature/rds-cluster-deletionprotection
Sep 5, 2023
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1d0be6a
feat: Add deletion protection attribute to RDS Cluster
dorayakikun a8eb0ee
chore: fix indent
dorayakikun 3053c54
fix run `make schema` task
dorayakikun f783d77
feat: Add docs and policies
dorayakikun c67e2fb
fix metadata (modify instance to cluster)
dorayakikun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
Enable deletion protection at RDS clusters | ||
|
||
```hcl | ||
resource "aws_rds_cluster" "good_example" { | ||
deletion_protection = true | ||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
Ensure deletion protection is enabled for RDS clusters. | ||
|
||
### Impact | ||
<!-- Add Impact here --> | ||
|
||
<!-- DO NOT CHANGE --> | ||
{{ remediationActions }} | ||
|
||
### Links | ||
- https://docs.aws.amazon.com/config/latest/developerguide/rds-cluster-deletion-protection-enabled.html | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
rules/cloud/policies/aws/rds/enable_cluster_deletion_protection.rego
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# METADATA | ||
# title: "RDS Deletion Protection Disabled" | ||
# description: "Ensure deletion protection is enabled for RDS database instances." | ||
# scope: package | ||
# schemas: | ||
# - input: schema["cloud"] | ||
# related_resources: | ||
# - https://docs.aws.amazon.com/config/latest/developerguide/rds-cluster-deletion-protection-enabled.html | ||
# custom: | ||
# avd_id: AVD-AWS-0343 | ||
# provider: aws | ||
# service: rds | ||
# severity: MEDIUM | ||
# short_code: enable-cluster-deletion-protection | ||
# recommended_action: "Modify the RDS clusters to enable deletion protection." | ||
# input: | ||
# selector: | ||
# - type: cloud | ||
# subtypes: | ||
# - service: rds | ||
# provider: aws | ||
package builtin.aws.rds.aws0343 | ||
|
||
deny[res] { | ||
cluster := input.aws.rds.clusters[_] | ||
not cluster.deletionprotection.value | ||
res := result.new("Cluster does not have Deletion Protection enabled", cluster.deletionprotection) | ||
} |
11 changes: 11 additions & 0 deletions
11
rules/cloud/policies/aws/rds/enable_cluster_deletion_protection_test.rego
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package builtin.aws.rds.aws0343 | ||
|
||
test_detects_when_disabled { | ||
r := deny with input as {"aws": {"rds": {"clusters": [{"deletionprotection": {"value": false}}]}}} | ||
count(r) == 1 | ||
} | ||
|
||
test_when_enabled { | ||
r := deny with input as {"aws": {"rds": {"clusters": [{"deletionprotection": {"value": true}}]}}} | ||
count(r) == 0 | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be changed to adapt for clusters instead of instances.