Skip to content

Commit 7f3b87b

Browse files
authored
fix(s3vectors): update invalid IAM condition key format (#1279)
1 parent 16e75ce commit 7f3b87b

4 files changed

Lines changed: 18 additions & 16 deletions

File tree

src/cdk-lib/s3vectors/vector-bucket.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -672,21 +672,19 @@ export class VectorBucket extends VectorBucketBase {
672672
actions: ['kms:Decrypt'],
673673
resources: ['*'],
674674
conditions: {
675-
ArnLike: {
675+
'ArnLike': {
676676
'aws:SourceArn': stack.formatArn({
677677
service: 's3vectors',
678678
resource: 'bucket',
679679
resourceName: '*',
680680
arnFormat: ArnFormat.SLASH_RESOURCE_NAME,
681681
}),
682682
},
683-
StringEquals: {
683+
'StringEquals': {
684684
'aws:SourceAccount': stack.account,
685685
},
686-
ForAnyValue: {
687-
StringEquals: {
688-
'kms:EncryptionContextKeys': ['aws:s3vectors:arn', 'aws:s3vectors:resource-id'],
689-
},
686+
'ForAnyValue:StringEquals': {
687+
'kms:EncryptionContextKeys': ['aws:s3vectors:arn', 'aws:s3vectors:resource-id'],
690688
},
691689
},
692690
}));

src/cdk-lib/s3vectors/vector-index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,21 +454,19 @@ export class VectorIndex extends VectorIndexBase {
454454
actions: ['kms:Decrypt'],
455455
resources: ['*'],
456456
conditions: {
457-
ArnLike: {
457+
'ArnLike': {
458458
'aws:SourceArn': stack.formatArn({
459459
service: 's3vectors',
460460
resource: 'bucket',
461461
resourceName: '*',
462462
arnFormat: ArnFormat.SLASH_RESOURCE_NAME,
463463
}),
464464
},
465-
StringEquals: {
465+
'StringEquals': {
466466
'aws:SourceAccount': stack.account,
467467
},
468-
ForAnyValue: {
469-
StringEquals: {
470-
'kms:EncryptionContextKeys': ['aws:s3vectors:arn', 'aws:s3vectors:resource-id'],
471-
},
468+
'ForAnyValue:StringEquals': {
469+
'kms:EncryptionContextKeys': ['aws:s3vectors:arn', 'aws:s3vectors:resource-id'],
472470
},
473471
},
474472
}));

test/cdk-lib/s3vectors/vector-bucket.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,15 @@ describe('VectorBucket', () => {
188188
},
189189
Action: 'kms:Decrypt',
190190
Condition: Match.objectLike({
191-
ArnLike: {
191+
'ArnLike': {
192192
'aws:SourceArn': Match.anyValue(),
193193
},
194-
StringEquals: {
194+
'StringEquals': {
195195
'aws:SourceAccount': '123456789012',
196196
},
197+
'ForAnyValue:StringEquals': {
198+
'kms:EncryptionContextKeys': ['aws:s3vectors:arn', 'aws:s3vectors:resource-id'],
199+
},
197200
}),
198201
}),
199202
]),

test/cdk-lib/s3vectors/vector-index.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,15 @@ describe('VectorIndex', () => {
268268
},
269269
Action: 'kms:Decrypt',
270270
Condition: Match.objectLike({
271-
ArnLike: {
271+
'ArnLike': {
272272
'aws:SourceArn': Match.anyValue(),
273273
},
274-
StringEquals: {
274+
'StringEquals': {
275275
'aws:SourceAccount': '123456789012',
276276
},
277+
'ForAnyValue:StringEquals': {
278+
'kms:EncryptionContextKeys': ['aws:s3vectors:arn', 'aws:s3vectors:resource-id'],
279+
},
277280
}),
278281
}),
279282
]),

0 commit comments

Comments
 (0)