Skip to content

fix(aws): accept aws:kms:dsse as valid S3 server-side encryption - #7634

Open
UTKARSH698 wants to merge 1 commit into
bridgecrewio:mainfrom
UTKARSH698:feat/s3-dsse-kms-encryption
Open

fix(aws): accept aws:kms:dsse as valid S3 server-side encryption#7634
UTKARSH698 wants to merge 1 commit into
bridgecrewio:mainfrom
UTKARSH698:feat/s3-dsse-kms-encryption

Conversation

@UTKARSH698

@UTKARSH698 UTKARSH698 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Description

S3 supports dual-layer server-side encryption with AWS KMS keys (DSSE-KMS), which reports an SSEAlgorithm of aws:kms:dsse. None of checkov's S3 encryption logic recognises that value, so a bucket using the strongest option AWS offers is currently reported as unencrypted.

This adds aws:kms:dsse alongside the existing aws:kms / AES256 values everywhere checkov decides whether an S3 bucket is encrypted:

Location Change
checkov/cloudformation/checks/resource/aws/S3Encryption.py (CKV_AWS_19) added to get_expected_values()
checkov/terraform/checks/graph_checks/aws/S3BucketEncryption.yaml (CKV_AWS_19) added to both within lists
checkov/terraform/checks/graph_checks/aws/S3KMSEncryptedByDefault.yaml (CKV_AWS_145) equals: "aws:kms"within: ["aws:kms", "aws:kms:dsse"]
checkov/{terraform,cloudformation}/graph_builder/graph_components/generic_resource_encryption.py added to the S3 encryption_ attribute mapping so the graph attribute agrees with the checks
checkov/common/graph/graph_builder/graph_components/attribute_names.py new EncryptionTypes.AWS_KMS_DSSE_VALUE constant

DSSE-KMS is KMS-backed, so passing CKV_AWS_145 ("encrypted with KMS by default") is the intended semantics, not a loosening of it.

Tests

  • tests/cloudformation/checks/resource/aws/test_S3Encryption.py::test_dsse_kms — new test over a new example_S3EncryptionDsse/ template covering DSSE-KMS, SSE-KMS, SSE-S3 (pass) and a near-miss aws:kms:dss (fail), so the check is not merely accepting any aws:kms* prefix. The existing S3Templates/ fixture is shared by 8 other test modules, so a separate directory avoids perturbing their counts.
  • Both terraform graph-check fixtures gain a DSSE-KMS bucket in each of the two supported shapes: the inline server_side_encryption_configuration block and a separate aws_s3_bucket_server_side_encryption_configuration resource.

Verified non-vacuous: with the test/fixture changes applied but the checkov/ source changes reverted, all three tests fail (test_dsse_kms, test_S3BucketEncryption, test_S3KMSEncryptedByDefault).

Regression run: tests/terraform/graph/checks/test_yaml_policies.py and tests/cloudformation/checks/resource/aws/ — 326 passed. flake8 and mypy clean on the changed files.

Note on prior art

@evan-schiewe proposed the CKV_AWS_19 terraform half of this in #7415 back in January and was closed by the stale bot on 2026-07-25 without ever being reviewed on its merits. This supersedes it and covers the CloudFormation check, CKV_AWS_145, and the graph-builder encryption attribute as well, all of which had the same gap.

DSSE-KMS (dual-layer server-side encryption with AWS KMS keys) reports
an SSEAlgorithm of "aws:kms:dsse", which none of the S3 encryption
checks recognised, so buckets using the strongest available option were
reported as unencrypted.
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.

1 participant