-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Closed
Labels
bugThis issue is a bug.This issue is a bug.
Description
The IAM policy optimization code (#916) has an issue that may cause unwanted extension of permissions.
Repro:
const doc = new iam.PolicyDocument();
doc.addStatement(new iam.PolicyStatement()
.addResource('bucket1')
.addActions('s3:read-only'));
doc.addStatement(new iam.PolicyStatement()
.addResource('bucket2')
.addActions('s3:*'));Output:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:*",
"Resource": [
"bucket1",
"bucket2"
]
}
]
}Expected (obvsiouly, we didn't want full access to "bucket1"):
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:read-only",
"Resource": "bucket1"
},
{
"Effect": "Allow",
"Action": "s3:*",
"Resource": "bucket2"
}
]
}Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.