-
Notifications
You must be signed in to change notification settings - Fork 28
* fix issue where removing an assumed-role's SDB permissions will mak… #182
Conversation
…e the assumed-role lose access to the SDB even if the base IAM role has permissions * fix issue where an assumed-role doesn't inherit base IAM role's admin privileges
@@ -46,6 +46,12 @@ public SafeDepositBoxDao(final SafeDepositBoxMapper safeDepositBoxMapper) { | |||
return safeDepositBoxMapper.getIamRoleAssociatedSafeDepositBoxRoles(awsIamRoleArn, iamRootArn); | |||
} | |||
|
|||
public List<SafeDepositBoxRoleRecord> getIamAssumedRoleAssociatedSafeDepositBoxRoles(final String iamAssumedRoleArn, | |||
final String awsIamRoleArn, | |||
final String iamRootArn) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace looks off
@@ -59,6 +65,12 @@ public SafeDepositBoxDao(final SafeDepositBoxMapper safeDepositBoxMapper) { | |||
return safeDepositBoxMapper.getIamPrincipalAssociatedSafeDepositBoxes(iamPrincipalArn, iamRootArn); | |||
} | |||
|
|||
public List<SafeDepositBoxRecord> getAssumedRoleAssociatedSafeDepositBoxes(final String iamAssumedRoleArn, | |||
final String iamRoleArn, | |||
final String iamRootArn) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace looks off
@@ -27,6 +27,12 @@ Boolean doesIamPrincipalHaveGivenRoleForSdb(@Param("sdbId") String sdbId, | |||
@Param("iamRootArn") String iamRootArn, | |||
@Param("rolesThatAllowPermission") Set<String> rolesThatAllowPermission); | |||
|
|||
Boolean doesAssumedRoleHaveGivenRoleForSdb(@Param("sdbId") String sdbId, | |||
@Param("assumedRoleArn") String assumedRoleArn, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace looks off
List<SafeDepositBoxRecord> getUserAssociatedSafeDepositBoxes(@Param("userGroups") Set<String> userGroups); | ||
|
||
List<SafeDepositBoxRecord> getUserAssociatedSafeDepositBoxesIgnoreCase(@Param("userGroups") Set<String> userGroups); | ||
|
||
List<SafeDepositBoxRecord> getIamPrincipalAssociatedSafeDepositBoxes(@Param("iamPrincipalArn") final String iamPrincipalArn, | ||
@Param("iamRootArn") final String iamRootArn); | ||
|
||
List<SafeDepositBoxRecord> getIamAssumedRoleAssociatedSafeDepositBoxes(@Param("iamAssumedRoleArn") final String iamAssumedRoleArn, | ||
@Param("iamRoleArn") final String iamRoleArn, | ||
@Param("iamRootArn") final String iamRootArn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace looks off
@@ -42,6 +42,30 @@ | |||
) as HAS_PERM; | |||
</select> | |||
|
|||
<select id="doesAssumedRoleHaveGivenRoleForSdb" resultType="Boolean"> | |||
SELECT NOT 0 >= ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace looks off
@@ -113,6 +113,18 @@ public boolean isRoleArn(final String arn) { | |||
return iamRoleArnMatcher.find(); | |||
} | |||
|
|||
/** | |||
* Returns true if the ARN is in format 'arn:aws:iam::000000000:role/example' and false if not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this example arn is for a role arn and not an assume role arn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…e the assumed-role lose access to the SDB even if the base IAM role has permissions