Skip to content

Commit 0b345c5

Browse files
authored
fix(iam): withConditions overrides Principal actions (#28510)
Calling `withConditions` after `withSessionTags` will override the existing `sts:TagSession` action for the statement. This implementation fixes the issue. Closes #28426. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 94003ec commit 0b345c5

11 files changed

+499
-1
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions-and-tags.js.snapshot/PrincipalWithConditionAndTagsDefaultTestDeployAssertA5074573.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions-and-tags.js.snapshot/PrincipalWithConditionAndTagsDefaultTestDeployAssertA5074573.template.json

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions-and-tags.js.snapshot/cdk.out

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions-and-tags.js.snapshot/integ-principal-with-conditions-and-tags.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"Resources": {
3+
"TestRole25D98AB21": {
4+
"Type": "AWS::IAM::Role",
5+
"Properties": {
6+
"AssumeRolePolicyDocument": {
7+
"Statement": [
8+
{
9+
"Action": [
10+
"sts:AssumeRole",
11+
"sts:TagSession"
12+
],
13+
"Condition": {
14+
"StringLike": {
15+
"aws:PrincipalTag/owner": "foo"
16+
},
17+
"Bool": {
18+
"aws:MultiFactorAuthPresent": "true"
19+
}
20+
},
21+
"Effect": "Allow",
22+
"Principal": {
23+
"AWS": "*"
24+
}
25+
}
26+
],
27+
"Version": "2012-10-17"
28+
}
29+
}
30+
}
31+
},
32+
"Parameters": {
33+
"BootstrapVersion": {
34+
"Type": "AWS::SSM::Parameter::Value<String>",
35+
"Default": "/cdk-bootstrap/hnb659fds/version",
36+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
37+
}
38+
},
39+
"Rules": {
40+
"CheckBootstrapVersion": {
41+
"Assertions": [
42+
{
43+
"Assert": {
44+
"Fn::Not": [
45+
{
46+
"Fn::Contains": [
47+
[
48+
"1",
49+
"2",
50+
"3",
51+
"4",
52+
"5"
53+
],
54+
{
55+
"Ref": "BootstrapVersion"
56+
}
57+
]
58+
}
59+
]
60+
},
61+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
62+
}
63+
]
64+
}
65+
}
66+
}

packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions-and-tags.js.snapshot/integ.json

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions-and-tags.js.snapshot/manifest.json

+113
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)