Review SQS message encryption settings

Distinguish SQS default encryption from explicitly disabled encryption and protect message bodies.

Description

A new CloudFormation queue uses SSE-SQS to encrypt message bodies when both KmsMasterKeyId and SqsManagedSseEnabled are omitted. Setting SqsManagedSseEnabled: false with no KMS key leaves new bodies unencrypted.

Potential impact

Message attributes fall outside body encryption. Use TLS for transport and a queue policy to control who can read messages.

Remediation

Set SqsManagedSseEnabled: true for SQS-managed keys or KmsMasterKeyId for SSE-KMS. A change affects newly sent messages. Keep access to any previous key until its messages are processed. Test sending and receiving with the application roles after the change.

Examples

Initially MyQueue uses default SSE-SQS and MyQueue2 disables encryption. After the change MyQueue uses the key supplied through QueueKeyId, and MyQueue2 uses SSE-SQS.

Before

yaml
Resources:
  MyQueue:
    Type: AWS::SQS::Queue
    Properties:
      QueueName: SampleQueue
  MyQueue2:
    Type: AWS::SQS::Queue
    Properties:
      QueueName: SampleQueue2
      SqsManagedSseEnabled: false

After

yaml
Resources:
  MyQueue:
    Type: AWS::SQS::Queue
    Properties:
      QueueName: SampleQueue
      KmsMasterKeyId: !Ref QueueKeyId
  MyQueue2:
    Type: AWS::SQS::Queue
    Properties:
      QueueName: SampleQueue2
      SqsManagedSseEnabled: true

References