feat(queries): add 20 new Terraform AWS queries with auto-remediation support#7991
Open
cx-antero-silva wants to merge 3 commits intoCheckmarx:masterfrom
Open
feat(queries): add 20 new Terraform AWS queries with auto-remediation support#7991cx-antero-silva wants to merge 3 commits intoCheckmarx:masterfrom
cx-antero-silva wants to merge 3 commits intoCheckmarx:masterfrom
Conversation
…ysis Gap analysis comparing KICS against Trivy/tfsec, Terrascan, Snyk IaC and Prowler identified security checks present in multiple tools but absent from KICS. All queries marked experimental: true. AWS Terraform (10 queries): - Beta - EMR Cluster Local Disk Encryption Disabled (HIGH, CWE-311) - Beta - CloudFormation Stack Termination Protection Disabled (MEDIUM, CWE-693) - Beta - API Gateway V2 CORS Wildcard Origin Allowed (HIGH, CWE-942) - Beta - Step Functions State Machine Logging Disabled (MEDIUM, CWE-778) - Beta - WAFv2 Web ACL Logging Disabled (MEDIUM, CWE-778) - Beta - Cognito User Pool Advanced Security Disabled (MEDIUM, CWE-307) - Beta - Route53 Zone Query Logging Disabled (LOW, CWE-778) - Beta - EventBridge Bus Allows Cross-Account Access (HIGH, CWE-284) - Beta - ECS Task Definition Without Read-Only Root Filesystem (HIGH, CWE-732) - Beta - Kinesis Firehose Delivery Stream SSE Disabled (HIGH, CWE-311) GCP Terraform (5 queries): - Beta - Cloud SQL PostgreSQL log_checkpoints Not Enabled (MEDIUM, CWE-778) - Beta - Cloud SQL PostgreSQL log_lock_waits Not Enabled (MEDIUM, CWE-778) - Beta - GKE Node Pool Auto-Repair Disabled (MEDIUM, CWE-693) - Beta - GKE Node Pool Auto-Upgrade Disabled (MEDIUM, CWE-1188) - Beta - GKE Cluster Stackdriver Logging Disabled (MEDIUM, CWE-778) Azure Terraform (5 queries): - Beta - Key Vault Key Expiry Not Set (MEDIUM, CWE-324) - Beta - Key Vault Secret Expiry Not Set (MEDIUM, CWE-324) - Beta - Storage Account Queue Logging Disabled (MEDIUM, CWE-778) - Beta - Container Registry Admin Account Enabled (HIGH, CWE-269) - Beta - Redis Cache Publicly Accessible (HIGH, CWE-668) Each query includes query.rego, metadata.json, and positive/negative test fixtures. Gap analysis sources: Trivy/tfsec, Terrascan, Snyk IaC, Prowler. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add remediation and remediationType fields to the following queries that previously lacked auto-remediation capability: - amazon_dms_replication_instance_is_publicly_accessible: replace true→false - cloudformation_stack_termination_protection_disabled: add true / replace false→true - ecs_services_assigned_with_public_ip_address: replace true→false (resource + module) - mq_broker_logging_disabled: replace false→true, add missing keys, add missing logs block - rds_cluster_with_backup_disabled: add backup_retention_period = 7 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
Your pull request can't be merged due to missing the Apache license statement. Please add the following statement at the end of the pr description:
In case the statement has already been added, make sure it is the last sentence in the description and the only one in its line. Thank you! |
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.
Summary
20 new Terraform AWS security queries (Beta)
New queries covering security misconfigurations across IAM, networking, encryption, logging, and access control.
Auto-remediation support added to 5 queries
The following queries include
remediationandremediationTypefields, enabling thekics remediatecommand to automatically fix detected issues:amazon_dms_replication_instance_is_publicly_accessibleIncorrectValuepublicly_accessibletrue → falsecloudformation_stack_termination_protection_disabledMissingAttributetermination_protection = truecloudformation_stack_termination_protection_disabledIncorrectValuetermination_protectionfalse → trueecs_services_assigned_with_public_ip_addressIncorrectValueassign_public_iptrue → false (resource + module)mq_broker_logging_disabledIncorrectValuemq_broker_logging_disabledMissingAttributegeneral/auditkeymq_broker_logging_disabledMissingAttributelogs { general = true / audit = true }blockrds_cluster_with_backup_disabledMissingAttributebackup_retention_period = 7Remediation patterns used
replacement→json.marshal({"before": "<current>", "after": "<desired>"})forIncorrectValueaddition→ plain string"key = value"or multiline block forMissingAttributeTest plan
kics scanand confirmremediationandremediation_typeappear in JSON outputkics remediateand verify Terraform files are patched correctly