A security engineer needs to ensure that all objects uploaded to an S3 bucket are encrypted at rest using a customer-managed KMS key. What is the most efficient way to enforce this requirement at the bucket level?
Trap 1: Configure an S3 Lifecycle policy to encrypt all objects with the…
Lifecycle policies are designed for transitions between storage classes or object expiration, not for enforcing encryption at the moment of ingestion. Relying on a lifecycle rule creates a window of vulnerability where data exists in an unencrypted or incorrectly encrypted state before the rule triggers.
Trap 2: Attach a bucket policy that denies s3:PutObject if the…
The bucket policy acts as a gatekeeper during the put operation. By explicitly checking for the KMS header, the policy ensures every object written to the bucket is protected by the specified key, effectively blocking any request that attempts to bypass this requirement or use different encryption settings.
Trap 3: Enable S3 Object Lock in compliance mode for all new objects in the…
S3 Object Lock is a WORM (Write Once, Read Many) feature intended to prevent data deletion or modification, not to enforce encryption. It provides data integrity and retention, but it does not mandate the use of a specific KMS key or any encryption method for the stored objects.
- A
Enable S3 default encryption for the bucket using the customer-managed key.
Default encryption settings automatically encrypt objects, but they do not prevent users from uploading objects with different encryption headers or no encryption at all if permissions allow. An explicit bucket policy is required to enforce specific encryption standards and reject non-compliant requests during the upload process.
- B
Configure an S3 Lifecycle policy to encrypt all objects with the KMS key after upload.
Why wrong: Lifecycle policies are designed for transitions between storage classes or object expiration, not for enforcing encryption at the moment of ingestion. Relying on a lifecycle rule creates a window of vulnerability where data exists in an unencrypted or incorrectly encrypted state before the rule triggers.
- C
Attach a bucket policy that denies s3:PutObject if the x-amz-server-side-encryption-aws-kms-key-id header is missing or incorrect.
Why wrong: The bucket policy acts as a gatekeeper during the put operation. By explicitly checking for the KMS header, the policy ensures every object written to the bucket is protected by the specified key, effectively blocking any request that attempts to bypass this requirement or use different encryption settings.
- D
Enable S3 Object Lock in compliance mode for all new objects in the bucket.
Why wrong: S3 Object Lock is a WORM (Write Once, Read Many) feature intended to prevent data deletion or modification, not to enforce encryption. It provides data integrity and retention, but it does not mandate the use of a specific KMS key or any encryption method for the stored objects.