mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
fix(iam): honor managed policy attachment conditions (#5578)
* fix(iam): honor managed policy attachment conditions * test(iam): keep managed policy group tests isolated
This commit is contained in:
1 parent
04dd78d0f6
commit
367ae0b2db
6 files changed
+377
-1
No files matched your search
@@ -83,6 +83,18 @@ public class IamConditionContextResolver {
|
||||
case "s3" -> s3ConditionContext(action, ctx);
|
||||
case "ec2" -> ec2ConditionContext(action, ctx);
|
||||
case "dynamodb" -> dynamoDbConditionContext(action, ctx);
|
||||
case "iam" -> iamConditionContext(action, ctx);
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
private static Map<String, List<String>> iamConditionContext(String action, ContainerRequestContext ctx) {
|
||||
return switch (action) {
|
||||
case "iam:AttachRolePolicy", "iam:DetachRolePolicy", "iam:AttachUserPolicy",
|
||||
"iam:DetachUserPolicy", "iam:AttachGroupPolicy", "iam:DetachGroupPolicy" -> {
|
||||
String policyArn = formParameters(ctx).get("PolicyArn");
|
||||
yield policyArn == null ? null : Map.of("iam:PolicyARN", List.of(policyArn));
|
||||
}
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user