-
Notifications
You must be signed in to change notification settings - Fork 4k
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
aws-s3: option for Bucket.grantDelete to not grant s3:DeleteObjectVersion #32375
Comments
Hi @plumdog , thanks for reaching out. just curious to understand your usecase, wouldn't it be feasbile using granting write access so user can modify the objects - {
"Sid": "statement2",
"Effect": "Deny",
"Principal": {
"AWS": "arn:aws:iam::123456789012:user/abcd"
},
"Action": [
"s3:DeleteObject",
"s3:DeleteObjectVersion",
"s3:PutLifecycleConfiguration"
],
"Resource": [
"arn:aws:s3:::amzn-s3-demo-bucket1",
"arn:aws:s3:::amzn-s3-demo-bucket1/*"
]
} Please feel free to correct me if this understanding is wrong. |
Hi @khushail, in principle I think there could be a way to add a deny for Regarding your example, I think I would still need for applications to have Ideally, I would identify a simple way of achieving this that I can advertise internally as the correct way of granting applications access to manage data within buckets. And so something like:
would work for this. Something requiring developers to add a policy would introduce more room for error which I would like to avoid if possible. |
Thanks for getting back and explaining your point of view in this context @plumdog . I totally understand your point when assigning the access and then denying it would be extra hassle and would leave markers and chance of error as well. Since there is no policy as |
Describe the feature
Allow an easy way of granting an identity permission to modify the contents of a versioned bucket, but not delete versions.
Use Case
I want to be able to grant applications permissions to modify objects in a bucket as they need to, but want be sure that they won't permanently delete data. Enabling versioning on the bucket allows this, but if the applications are granted
s3:DeleteObjectVersion
then a bug or compromise of that application could still delete all data from the bucket including previous versions.I think this one of the natural uses of S3 versioning, and so the CDK making it easy to grant a suitable set of permissions for this would be helpful.
Proposed Solution
Perhaps add an option like
exceptVersions: boolean
toBucket.grantDelete
. Or maybe add a new method.Other Information
There might already be an easy way to do this with the other
Bucket.grant*
methods, eg withBucket.grantWrite
and passing some values from https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-s3/lib/perms.ts as the third argument.Acknowledgements
CDK version used
2.171.1
Environment details (OS name and version, etc.)
n/a
The text was updated successfully, but these errors were encountered: