Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(s3): autoDeleteObjects had redundant GetObject* permissions #14573

Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-s3/lib/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1840,7 +1840,8 @@ export class Bucket extends BucketBase {
// objects in the bucket
this.addToResourcePolicy(new iam.PolicyStatement({
actions: [
...perms.BUCKET_READ_ACTIONS, // list objects
// list objects
...perms.BUCKET_READ_METADATA_ACTIONS,
...perms.BUCKET_DELETE_ACTIONS, // and then delete them
],
resources: [
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-s3/lib/perms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ export const BUCKET_READ_ACTIONS = [
's3:List*',
];

export const BUCKET_READ_METADATA_ACTIONS = [
's3:GetBucket*',
's3:List*',
];

export const LEGACY_BUCKET_PUT_ACTIONS = [
's3:PutObject*',
's3:Abort*',
Expand Down
1 change: 0 additions & 1 deletion packages/@aws-cdk/aws-s3/test/bucket.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2385,7 +2385,6 @@ describe('bucket', () => {
'Statement': [
{
'Action': [
's3:GetObject*',
's3:GetBucket*',
's3:List*',
's3:DeleteObject*',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"Statement": [
{
"Action": [
"s3:GetObject*",
"s3:GetBucket*",
"s3:List*",
"s3:DeleteObject*"
Expand Down