feat(query): add "RDS Deletion Protection Disabled" query for Terraform/AWS#8075
Open
Muhammaduazir69 wants to merge 1 commit into
Open
feat(query): add "RDS Deletion Protection Disabled" query for Terraform/AWS#8075Muhammaduazir69 wants to merge 1 commit into
Muhammaduazir69 wants to merge 1 commit into
Conversation
Adds a new KICS query that flags Amazon RDS databases provisioned without deletion protection. Covers both aws_db_instance and aws_rds_cluster (Aurora) for the deletion_protection = false case and the undefined case (the Terraform/AWS default is false, i.e. unprotected). KICS already ships an ALB deletion-protection query but had no RDS equivalent, despite RDS holding persistent data where accidental or malicious deletion is more damaging. Severity MEDIUM, CWE-693. Signed-off-by: Muhammad Uzair <muhammaduzairr69@gmail.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Adds a new KICS query that flags Amazon RDS databases provisioned without deletion protection. It covers both
aws_db_instanceandaws_rds_cluster(Aurora), reporting whendeletion_protectionis either set tofalse(IncorrectValue) or omitted entirely (MissingAttribute — the Terraform/AWS default isfalse, i.e. unprotected).Motivation
KICS already ships
ALB Deletion Protection Disabled(aws_lb/aws_alb), but there is no equivalent coverage for RDS, despite RDS holding persistent data where accidental or malicious deletion is far more damaging. Confirmed gap: no existing query referencesdeletion_protectiononaws_db_instance/aws_rds_cluster.What the query checks
aws_db_instancedeletion_protection = falseaws_db_instancedeletion_protectionundefinedaws_rds_clusterdeletion_protection = falseaws_rds_clusterdeletion_protectionundefinedSecure configurations (
deletion_protection = true) are covered by the negative tests and produce no findings.Metadata
descriptionUrl→ Terraform AWS providerdb_instance#deletion_protectionTesting
make test-unit— new query positive/negative tests pass; full suite green (55 packages, 0 failures)../bin/kics scanon both samples (positive → 4 MEDIUM findings, negative → 0).metadata.jsonvalidated against.github/scripts/queries-validator/metadata-schema.json.I submit this contribution under the Apache-2.0 license.