Skip to content

Commit 06678a3

Browse files
authored
fix(scheduler-alpha): too many KMS permissions granted (#31923)
### Issue # (if applicable) Tracking #31785. ### Reason for this change When customer use a KMS Customer Managed Key (CMK) with the `Schedule` construct, the following permissions are added to the scheduler execution role: ``` 'kms:Decrypt', 'kms:Encrypt', 'kms:ReEncrypt*', 'kms:GenerateDataKey*' ``` However, upon testing, having only the `kms:Decrypt` permission is enough for the Schedule to invoke the target (Lambda Function as a target was used in the test.). ### Description of changes This PR removes the unneeded KMS permissions and updated integ test to verify that the schedule is still able to invoke the target. ### Description of how you validated changes Unit test and integ test. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* ---- BREAKING CHANGE: Extra KMS permissions are removed from Schedule execution role when KMS key is passed to Schedule.
1 parent a9d3b02 commit 06678a3

File tree

10 files changed

+31923
-565
lines changed

10 files changed

+31923
-565
lines changed

packages/@aws-cdk/aws-scheduler-alpha/lib/schedule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ export class Schedule extends Resource implements ISchedule {
279279

280280
this.key = props.key;
281281
if (this.key) {
282-
this.key.grantEncryptDecrypt(targetConfig.role);
282+
this.key.grantDecrypt(targetConfig.role);
283283
}
284284

285285
this.retryPolicy = targetConfig.retryPolicy;

0 commit comments

Comments
 (0)