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

s3fs: Adds support for SSE client keys #7671

Merged
merged 5 commits into from Jun 21, 2022
Merged

Conversation

ap-kulkarni
Copy link
Contributor

@ap-kulkarni ap-kulkarni commented May 1, 2022

Fixes #6141

  • ❗ I have followed the Contributing to DVC checklist.

  • πŸ“– If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.
    Thank you for the contribution - we'll try to review it as soon as possible. πŸ™

@ap-kulkarni ap-kulkarni requested a review from a team as a code owner May 1, 2022 16:49
@ap-kulkarni
Copy link
Contributor Author

I will raise a separate PR for documentation and link it here once the code changes are agreed by reviewers.

…ES256 if sse_customer_key is specified and no algorithm is specified
@ap-kulkarni
Copy link
Contributor Author

Created PR at dvc.org#3498 for documentations changes

dvc/fs/s3.py Outdated
Comment on lines 121 to 126
sse_params = SSEParams(
server_side_encryption=config.get("sse"),
sse_customer_algorithm=sse_customer_algorithm,
sse_customer_key=sse_customer_key,
sse_kms_key_id=config.get("sse_kms_key_id"),
)
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if these belong in s3fs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure exactly what the question meant. However, I would go ahead explain the snippet tagged. This SSEParams is just a helper class which accepts these parameters and provides a method to_kwargs() which returns a dictionary with appropriate key names required by aws libraries. Before these changes, the key names were hardcoded like below

        additional["ServerSideEncryption"] = config.get("sse")
        additional["SSEKMSKeyId"] = config.get("sse_kms_key_id")

Now, this is achieved by appropriately constructing the SSEParams object, and then updating the additional dictionary with the dictionary obtained from to_kwargs() like below

        additional.update(sse_params.to_kwargs())

@efiop efiop self-requested a review June 7, 2022 12:33
@ap-kulkarni
Copy link
Contributor Author

Let me know if this PR requires any more work.

@dberenbaum
Copy link
Contributor

Sorry, @ap-kulkarni, we haven't had a chance to take a close look. We will try to do that soon and let you know if anything is needed πŸ™ .

Copy link
Contributor

@daavoo daavoo left a comment

Choose a reason for hiding this comment

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

Hi @ap-kulkarni ! Unfortunately, during the period of the review process, some of the files modified here (dvc/fs/s3.py) were refactored out to a separate repo (https://github.com/iterative/dvc-objects/blob/main/src/dvc_objects/fs/implementations/s3.py) . You would need to move part of the changes to dvc-objects and open a P.R. there πŸ™

@ap-kulkarni
Copy link
Contributor Author

Thank you @daavoo. What would be the best course of action then? Should this PR be closed and fresh sets of PRs be raised? or should I just raise PR for changes in s3.py in dvc-objects project and keep this PR?

@daavoo
Copy link
Contributor

daavoo commented Jun 17, 2022

Should this PR be closed and fresh sets of PRs be raised? or should I just raise PR for changes in s3.py in dvc-objects project and keep this PR?

I would just remove s3.py and test changes from this P.R. and open a new P.R. in dvc-objects project

@ap-kulkarni
Copy link
Contributor Author

Opened PR #68 in dvc-objects. One question.. I saw that dvc-objects doesn't contain the tests for s3. They are still part of dvc. Should I raise a separate PR for adding tests once this PR gets merged? I observed that if I keep the test changes in this PR, then test runs fail here.

@efiop
Copy link
Member

efiop commented Jun 21, 2022

@ap-kulkarni Thank you for your patience!

Regarding tests, please do add them to this PR. You can run them locally to ensure that they work using --enable-s3 flag. We are reorganizing our code base right now, so long term your tests from this PR will be migrated to https://github.com/iterative/dvc-s3

Copy link
Member

@efiop efiop left a comment

Choose a reason for hiding this comment

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

Ok, with dvc-objects released, let's merge for now. Thank you! πŸ™

@efiop efiop merged commit 9a1a3a0 into iterative:main Jun 21, 2022
@pmrowla pmrowla added feature is a feature fs: s3 Related to the S3 filesystem labels Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature is a feature fs: s3 Related to the S3 filesystem
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Support provision of Client Keys for SSE-C Server Side Encryption
7 participants