mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(s3): read the default encryption only from ApplyServerSideEncryptionByDefault (#9210)
This commit is contained in:
1 parent
8183404fbd
commit
dda3b96dee
2 files changed
+28
-10
No files matched your search
@@ -164,6 +164,23 @@ class S3DefaultEncryptionServiceTest {
|
||||
|
||||
s3Service.putBucketEncryption(BUCKET, "not xml");
|
||||
assertEquals("AES256", put("malformed-configuration.txt", new PutObjectOptions()).getServerSideEncryption());
|
||||
|
||||
s3Service.putBucketEncryption(BUCKET, configuration("aws:kms", KMS_KEY) + "<Broken>");
|
||||
assertEquals("AES256", put("truncated-configuration.txt", new PutObjectOptions()).getServerSideEncryption());
|
||||
}
|
||||
|
||||
@Test
|
||||
void aDefaultOutsideTheRuleIsIgnored() {
|
||||
s3Service.putBucketEncryption(BUCKET, "<ServerSideEncryptionConfiguration>"
|
||||
+ "<Elsewhere><SSEAlgorithm>AES256</SSEAlgorithm><KMSMasterKeyID>other-key</KMSMasterKeyID></Elsewhere>"
|
||||
+ "<Rule><ApplyServerSideEncryptionByDefault><SSEAlgorithm>aws:kms</SSEAlgorithm>"
|
||||
+ "<KMSMasterKeyID>" + KMS_KEY + "</KMSMasterKeyID></ApplyServerSideEncryptionByDefault></Rule>"
|
||||
+ "</ServerSideEncryptionConfiguration>");
|
||||
|
||||
S3Object put = put("rule.txt", new PutObjectOptions());
|
||||
|
||||
assertEquals("aws:kms", put.getServerSideEncryption());
|
||||
assertEquals(KMS_KEY, put.getSseKmsKeyId());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user