Skip to content

fix(cloudformation): accept SqsManagedSseEnabled for CKV_AWS_27#7588

Open
arpitjain099 wants to merge 1 commit into
bridgecrewio:mainfrom
arpitjain099:chore/ckv-aws-27-sqs-sse
Open

fix(cloudformation): accept SqsManagedSseEnabled for CKV_AWS_27#7588
arpitjain099 wants to merge 1 commit into
bridgecrewio:mainfrom
arpitjain099:chore/ckv-aws-27-sqs-sse

Conversation

@arpitjain099

Copy link
Copy Markdown

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Description

Fixes #7381

CKV_AWS_27 for CloudFormation only inspects Properties/KmsMasterKeyId, so an AWS::SQS::Queue that relies on native SQS-managed SSE (SqsManagedSseEnabled: true) is reported as FAILED even though the queue is encrypted. The Terraform check for the same ID already accepts sqs_managed_sse_enabled, so this just brings the CloudFormation side to parity.

The fix overrides scan_resource_conf to return PASSED when SQS-managed SSE is enabled, and otherwise falls back to the existing KmsMasterKeyId logic (same pattern as CKV_AWS_161 / RDSIAMAuthentication).

One thing to call out on the typing: the CFN parser yields a real bool for true/false, but a quoted value like "false" comes through as a (truthy) string node. That's the case James raised on the earlier attempt (#5870), which otherwise looked good. I picked that approach up and handled it explicitly, so SqsManagedSseEnabled: "false" still FAILS rather than slipping through on truthiness. I kept the change scoped to the false positive and didn't touch the no-property default behavior.

Tests: added a PASSED fixture (SqsManagedSseEnabled: true) and a FAILED fixture (SqsManagedSseEnabled: "false"), and bumped the expected counts. The existing KMS-key and empty-key cases are unchanged.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my feature, policy, or fix is effective and works

CKV_AWS_27 only inspected Properties/KmsMasterKeyId, so a queue using
native SQS-managed SSE (SqsManagedSseEnabled: true) was reported as FAILED
even though it is encrypted. The Terraform check for the same ID already
treats sqs_managed_sse_enabled as a valid alternative to a KMS key.

Override scan_resource_conf to pass when SQS-managed SSE is enabled, then
fall back to the existing KmsMasterKeyId logic. The CFN parser yields a bool
for true/false but a (truthy) string for quoted values, so the string form
is handled explicitly to keep SqsManagedSseEnabled: "false" failing.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CloudFormation CKV_AWS_27 does not support SqsManagedSseEnabled property for encryption

1 participant