API Gateway cache encryption is disabled

Encrypt sensitive responses cached by API Gateway, and review cache keys and access permissions alongside encryption.

Description

To encrypt cached REST API responses at rest, set CacheDataEncrypted: true under the deployment’s StageDescription.

Potential impact

First decide which sensitive responses may be cached. Even with encryption, users can receive the wrong response if their cache keys overlap.

Remediation

Check the deployed method overrides, permissions, cache keys and expiry. For a user-specific route, sign in as two different users and verify that each receives only their own response. Leave the route uncached if you cannot isolate users. Flushing the cache temporarily increases backend traffic.

Examples

Set MyApi to a REST API with methods and integrations. Both examples provision a cache cluster and incur cache charges.

Cache encryption disabled

yaml
Parameters:
  MyApi:
    Type: String
Resources:
  Deployment:
    Type: AWS::ApiGateway::Deployment
    Properties:
      RestApiId: !Ref MyApi
      Description: My deployment
      StageName: DummyStage
      StageDescription:
        CacheClusterEnabled: true
        CacheClusterSize: "0.5"
        CachingEnabled: true
        CacheDataEncrypted: false

Cache encryption enabled

yaml
Parameters:
  MyApi:
    Type: String
Resources:
  Deployment:
    Type: AWS::ApiGateway::Deployment
    Properties:
      RestApiId: !Ref MyApi
      Description: My deployment
      StageName: DummyStage
      StageDescription:
        CacheClusterEnabled: true
        CacheClusterSize: "0.5"
        CachingEnabled: true
        CacheDataEncrypted: true

References