Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
fix: Fix BYOB app role to only modify FS roles (#454)
Browse files Browse the repository at this point in the history
This change ensures that root application roles cannot be used to modify themselves and they are just used for creating and modifying file system roles which have a permission boundary
  • Loading branch information
jn1119 authored Apr 21, 2021
1 parent 8e89282 commit 35f6cce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ describe('toCfnResources', () => {
],
Effect: 'Allow',
Resource: [
'arn:aws:iam::1122334455:role/swb-IhsKhN8GsLneiis11ujlb8-*',
'arn:aws:iam::1122334455:policy/swb-IhsKhN8GsLneiis11ujlb8-*',
'arn:aws:iam::1122334455:role/swb-IhsKhN8GsLneiis11ujlb8-fs-*',
'arn:aws:iam::1122334455:policy/swb-IhsKhN8GsLneiis11ujlb8-fs-*',
],
Sid: 'RoleAndPolicyManagement',
},
Expand All @@ -304,7 +304,7 @@ describe('toCfnResources', () => {
},
},
Effect: 'Allow',
Resource: 'arn:aws:iam::1122334455:role/swb-IhsKhN8GsLneiis11ujlb8-*',
Resource: 'arn:aws:iam::1122334455:role/swb-IhsKhN8GsLneiis11ujlb8-fs-*',
Sid: 'RoleCreation',
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,15 @@ function toRoleCfnResource(appRoleEntity, swbMainAccountId) {
'iam:GetRolePolicy',
],
Resource: [
`arn:aws:iam::${accountId}:role/${qualifier}-*`,
`arn:aws:iam::${accountId}:policy/${qualifier}-*`,
`arn:aws:iam::${accountId}:role/${qualifier}-fs-*`,
`arn:aws:iam::${accountId}:policy/${qualifier}-fs-*`,
],
},
{
Sid: 'RoleCreation',
Effect: 'Allow',
Action: 'iam:CreateRole',
Resource: `arn:aws:iam::${accountId}:role/${qualifier}-*`,
Resource: `arn:aws:iam::${accountId}:role/${qualifier}-fs-*`,
Condition: {
StringEquals: {
'iam:PermissionsBoundary': boundaryPolicyArn,
Expand Down

0 comments on commit 35f6cce

Please sign in to comment.