Skip to content

Commit

Permalink
Restrict resource for iam:PassRole to be scoped to createJobRequest.Role
Browse files Browse the repository at this point in the history
  • Loading branch information
PavanRangudu committed May 23, 2024
1 parent aa1b58d commit 562cedc
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 12 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,17 @@
"PolicyDocument": {
"Statement": [
{
"Action": [
"iam:PassRole",
"mediaconvert:CreateJob"
],
"Action": "iam:PassRole",
"Condition": {
"StringLike": {
"iam:PassedToService": "mediaconvert.amazonaws.com"
}
},
"Effect": "Allow",
"Resource": "arn:aws:iam::123456789012:role/MediaConvertRole"
},
{
"Action": "mediaconvert:CreateJob",
"Effect": "Allow",
"Resource": "*"
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ export class MediaConvertCreateJob extends sfn.TaskStateBase {
const policyStatements = [
new iam.PolicyStatement({
actions: ['iam:PassRole'],
resources: ['*'],
resources: [this.props.createJobRequest.Role],
conditions: {
StringLike: { 'iam:PassedToService': 'mediaconvert.amazonaws.com' },
},
}),
new iam.PolicyStatement({
actions: ['mediaconvert:CreateJob'],
Expand Down

0 comments on commit 562cedc

Please sign in to comment.