8000 ExpectedBucketOwner for S3 bucket policy operations by nikosmichas · Pull Request #11827 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content

ExpectedBucketOwner for S3 bucket policy operations #11827

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

Merged

Conversation

nikosmichas
Copy link
Contributor

Motivation

Closes #11826

Changes

Implement the ExpectedBucketOwner parameter and its behavior in 3 S3 operations:

  • PutBucketPolicy
  • GetBucketPolicy
  • DeleteBucketPolicy.

This parameter is currently ignored in LocalStack S3.

Copy link
Collaborator
@localstack-bot localstack-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to LocalStack! Thanks for raising your first Pull Request and landing in your contributions. Our team will reach out with any reviews or feedbacks that we have shortly. We recommend joining our Slack Community and share your PR on the #community channel to share your contributions with us. Please make sure you are following our contributing guidelines and our Code of Conduct.

@localstack-bot
Copy link
Collaborator
localstack-bot commented Nov 11, 2024

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@nikosmichas
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

localstack-bot added a commit that referenced this pull request Nov 11, 2024
@bentsku bentsku added aws:s3 Amazon Simple Storage Service semver: patch Non-breaking changes which can be included in patch releases labels Nov 12, 2024
@nikosmichas nikosmichas force-pushed the expectedbucketowner-policy-operations branch from 2b62387 to b541ef1 Compare November 15, 2024 08:51
@nikosmichas nikosmichas marked this pull request as ready for review November 15, 2024 11:03
@nikosmichas nikosmichas requested a review from bentsku as a code owner November 15, 2024 11:03
Copy link
Contributor
@bentsku bentsku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really great! I really like the approach, using existing methods, clearly splitting tests for what they are really testing, and allowing a progressive implementation of the ExpectedBucketOwner parameter through S3 API operations.

I really appreciate the thorough testing and use of parametrization.

I only have 2 comments:

  • We cannot modify the localstack-core/localstack/aws/api/s3/__init__.py file manually as it is auto-generated, and while running our automatic spec generation pipeline every week, those changes would be overwritten. I've added a comment to resolve this point, and is the only "blocking" point of the PR before a merge
  • other very minor comment is related to the clean-up of the automatically generated file, while renaming tests. This is also a shortcoming of our utility, and is not really blocking but would be appreciated.

All in all, the implementation is really clean, congratulations. 🚀

Once the comments are addressing, this is good to merge ✅

edit: thanks for also creating the GitHub issue linked to the PR 🙏

self,
context: RequestContext,
bucket_name: BucketName,
*,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice use of * to force the use of the keyword-only parameters! 🚀

@@ -964,31 +978,132 @@ def test_create_bucket_via_host_name(self, s3_vhost_client, aws_client, region_n
s3_vhost_client.delete_bucket(Bucket=bucket_name)

@markers.aws.validated
def test_put_and_get_bucket_policy(self, s3_bucket, snapshot, aws_client, allow_bucket_acl):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice refactoring of the tests, this makes it easier to validate all the use-cases now 💯

@bentsku bentsku added this to the 4.0 milestone Nov 15, 2024
@nikosmichas
Copy link
Contributor Author

Thanks for the feedback @bentsku
I pushed some changes to address them.

Copy link
Contributor
@bentsku bentsku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thank you for addressing the comments! 🙏 Great work, LGTM 👍

@bentsku bentsku merged commit b17f4a1 into localstack:master Nov 20, 2024
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws:s3 Amazon Simple Storage Service semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature request: S3 ExpectedBucketOwner for bucket policy operations
3 participants
0